Skip to content

Commit

Permalink
fix: Disable caching for respond_as_web_page response (#8276)
Browse files Browse the repository at this point in the history
* fix: Do not cache workflow approval confirmation page

* fix: Make it readable

* fix: Disable caching for respond_as_web_page

* fix: Remove info about no_cache from docstring
  • Loading branch information
surajshetty3416 authored and netchampfaris committed Aug 27, 2019
1 parent 2eebc46 commit 84c3eb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ def respond_as_web_page(title, html, success=None, http_status_code=None,
:param context: web template context
:param indicator_color: color of indicator in title
:param primary_action: route on primary button (default is `/`)
:param primary_label: label on primary button (defaut is "Home")
:param primary_label: label on primary button (default is "Home")
:param fullpage: hide header / footer
:param width: Width of message in pixels
:param template: Optionally pass view template
Expand All @@ -1171,6 +1171,8 @@ def respond_as_web_page(title, html, success=None, http_status_code=None,
local.message = html
local.response['type'] = 'page'
local.response['route'] = template
local.no_cache = 1

if http_status_code:
local.response['http_status_code'] = http_status_code

Expand Down
10 changes: 6 additions & 4 deletions frappe/workflow/doctype/workflow_action/workflow_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def confirm_action(doctype, docname, user, action):
return_success_page(newdoc)

# reset session user
frappe.set_user(logged_in_user)
if logged_in_user == 'Guest':
frappe.set_user(logged_in_user)

def return_success_page(doc):
frappe.respond_as_web_page(_("Success"),
Expand All @@ -116,9 +117,10 @@ def return_action_confirmation_page(doc, action, action_link, alert_doc_change=F

template_params['pdf_link'] = get_pdf_link(doc.get('doctype'), doc.get('name'))

frappe.respond_as_web_page(None, None,
indicator_color="blue",
template="confirm_workflow_action",
frappe.respond_as_web_page(title=None,
html=None,
indicator_color='blue',
template='confirm_workflow_action',
context=template_params)

def return_link_expired_page(doc, doc_workflow_state):
Expand Down

0 comments on commit 84c3eb3

Please sign in to comment.