Commit ef1100d9 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_hal_json_style] Propagate portal status message via a JSON document

parent ae932987
...@@ -262,23 +262,4 @@ if context.REQUEST.get('is_web_mode', False) and \ ...@@ -262,23 +262,4 @@ if context.REQUEST.get('is_web_mode', False) and \
not editable_mode: not editable_mode:
form_id = 'view' form_id = 'view'
if not selection_index: return context.Base_redirect(keep_items={'portal_status_message': message})
redirect_url = '%s?ignore_layout:int=%s&editable_mode:int=%s&portal_status_message=%s' % (
form_id,
ignore_layout,
editable_mode,
message)
else:
redirect_url = '%s?selection_index=%s&selection_name=%s&ignore_layout:int=%s&editable_mode=%s&portal_status_message=%s' % (
form_id,
selection_index,
selection_name,
ignore_layout,
editable_mode,
message)
if silent_mode: return result, 'redirect'
return context.Base_redirect(redirect_url)
...@@ -34,4 +34,4 @@ for f in form.get_fields(): ...@@ -34,4 +34,4 @@ for f in form.get_fields():
redirect_document = context.newContent(portal_type=doaction_param_list['portal_type']) redirect_document = context.newContent(portal_type=doaction_param_list['portal_type'])
return redirect_document.Base_redirect() return redirect_document.Base_redirect(keep_items={'portal_status_message': 'Document created.'})
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
be redundant. be redundant.
""" """
from ZTUtils import make_query from ZTUtils import make_query
import json
request_form = context.REQUEST.form request_form = context.REQUEST.form
request_form.update(kw) request_form.update(kw)
request_form = context.ERP5Site_filterParameterList(request_form) request_form = context.ERP5Site_filterParameterList(request_form)
...@@ -32,4 +34,14 @@ context.Base_prepareCorsResponse(RESPONSE=response) ...@@ -32,4 +34,14 @@ context.Base_prepareCorsResponse(RESPONSE=response)
# http://en.wikipedia.org/wiki/Post/Redirect/Get # http://en.wikipedia.org/wiki/Post/Redirect/Get
response.setStatus(201) response.setStatus(201)
response.setHeader("X-Location", "urn:jio:get:%s" % context.getRelativeUrl()) response.setHeader("X-Location", "urn:jio:get:%s" % context.getRelativeUrl())
return
result_dict = {
'portal_status_message': "%s" % keep_items.pop("portal_status_message", ""),
'_links': {
"self": {
# XXX Include query parameters
"href": context.Base_getRequestUrl()
}
}
}
return json.dumps(result_dict, indent=2)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment