From 16fc29e48dfe2ac2136de97d41a37f29b2154cc9 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Tue, 27 Oct 2020 14:18:06 +0530 Subject: [PATCH] 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 --- frappe/utils/pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/utils/pdf.py b/frappe/utils/pdf.py index 86c5c0cef5..ce9dab58d1 100644 --- a/frappe/utils/pdf.py +++ b/frappe/utils/pdf.py @@ -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))