diff --git a/frappe/app.py b/frappe/app.py index e7e0894387..c45d360134 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -35,6 +35,10 @@ def application(request): rollback = True init_site(request) + + if frappe.local.conf.get('maintainance_mode'): + raise frappe.SessionStopped + make_form_dict(request) frappe.local.http_request = frappe.auth.HTTPRequest() @@ -85,7 +89,7 @@ def application(request): frappe.db.rollback() # set cookies - if response: + if response and hasattr(frappe.local, 'cookie_manager'): frappe.local.cookie_manager.flush_cookies(response=response) frappe.destroy() diff --git a/frappe/utils/response.py b/frappe/utils/response.py index d675d3ad1f..89ac744aa5 100644 --- a/frappe/utils/response.py +++ b/frappe/utils/response.py @@ -161,4 +161,4 @@ def handle_session_stopped(): """) response.status_code = 503 response.content_type = 'text/html' - return res + return response