fix: Run after_hooks only if site is initialized

This commit is contained in:
Gavin D'souza 2023-03-01 16:52:58 +05:30
parent 9c28368213
commit 9e87596cf1

View file

@ -77,8 +77,9 @@ def application(request: Request):
if request.method in UNSAFE_HTTP_METHODS and frappe.db and rollback:
frappe.db.rollback()
for after_request_task in frappe.get_hooks("after_request"):
frappe.call(after_request_task, response=response, request=request)
if getattr(frappe.local, "initialised", False):
for after_request_task in frappe.get_hooks("after_request"):
frappe.call(after_request_task, response=response, request=request)
log_request(request, response)
process_response(response)