fix(pdf): frappe.local.request is not available in backgound jobs and tests

Use frappe.utils.get_host_name instead of frappe.local.request.host
This commit is contained in:
Aditya Hase 2020-10-27 14:18:06 +05:30
parent 3f5f6f3b21
commit 16fc29e48d
No known key found for this signature in database
GPG key ID: 0A55F0FCA0234972

View file

@ -129,7 +129,7 @@ def get_cookie_options():
# Remove port from request.host
# https://werkzeug.palletsprojects.com/en/0.16.x/wrappers/#werkzeug.wrappers.BaseRequest.host
domain = frappe.local.request.host.split(":", 1)[0]
domain = frappe.utils.get_host_name().split(":", 1)[0]
with open(cookiejar, "w") as f:
f.write("sid={}; Domain={};\n".format(frappe.session.sid, domain))