Commit 4ded2a2b authored by Julien Muchembled's avatar Julien Muchembled

New Base_redirect parameter to 'raise Redirect' and deprecate ERP5Site_redirect

parent 3b7aa99e
......@@ -60,17 +60,20 @@
TODO: improve API and extensively document. ERP5Site_redirect may \n
be redundant.\n
"""\n
# BBB: originally, form_id was the first positional argument\n
if not redirect_url or \'/\' not in redirect_url:\n
form_id = redirect_url or kw.pop(\'form_id\', None)\n
redirect_url = context.absolute_url()\n
if form_id:\n
redirect_url += \'/\' + form_id\n
\n
from ZTUtils import make_query\n
request_form = context.REQUEST.form\n
request = context.getPortalObject().REQUEST\n
request_form = request.form\n
request_form.update(kw)\n
request_form = context.ERP5Site_filterParameterList(request_form)\n
request_form.update(keep_items)\n
\n
if form_id == \'view\':\n
redirect_url = context.absolute_url()\n
else:\n
redirect_url = \'%s/%s\' % (context.absolute_url(), form_id)\n
\n
parameters = make_query(dict([(k, v) for k, v in request_form.items() if k and v is not None]))\n
if len(parameters):\n
if \'?\' in redirect_url:\n
......@@ -79,14 +82,17 @@ if len(parameters):\n
separator = \'?\'\n
redirect_url = \'%s%s%s\' % (redirect_url, separator, parameters)\n
\n
return context.REQUEST.RESPONSE.redirect( redirect_url )\n
if abort_transaction:\n
from zExceptions import Redirect\n
raise Redirect(redirect_url)\n
  • erp5_hal_json_style have a copy of Base_redirect which does not implement abort_transaction

    /cc @romain @katomaso

Please register or sign in to reply
return request.RESPONSE.redirect(redirect_url)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id=\'view\', keep_items={}, **kw</string> </value>
<value> <string>redirect_url=None, keep_items=(), abort_transaction=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,35 +50,12 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from ZTUtils import make_query\n
request_form = context.REQUEST.form\n
request_form.update(kw)\n
request_form = context.ERP5Site_filterParameterList(request_form)\n
request_form.update(keep_items)\n
\n
# JPS-XXX Why ERP5Site ? not Base ? \n
\n
if redirect_url is None:\n
redirect_url = context.getPortalObject().absolute_url()\n
\n
parameters = make_query(dict([(k, v) for k, v in request_form.items() if k and v is not None]))\n
if len(parameters):\n
if \'?\' in redirect_url:\n
separator = \'&\'\n
else:\n
separator = \'?\'\n
redirect_url = \'%s%s%s\' % (redirect_url, separator, parameters)\n
\n
return context.REQUEST.RESPONSE.redirect( redirect_url )\n
]]></string> </value>
<value> <string>return context.getPortalObject().Base_redirect(redirect_url, keep_items, **kw)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>redirect_url=None, keep_items={}, **kw</string> </value>
<value> <string>redirect_url=None, keep_items=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
1092
\ No newline at end of file
1093
\ No newline at end of file
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