Commit 20c1c4bc authored by Jean-Paul Smets's avatar Jean-Paul Smets

2006-12-29 JPS - Updated redirect scripts to simplify API. More factoring needed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11792 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 246fa354
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
"""\n
This script factorises code required to redirect to the appropriate\n
page from a script. It should probably be extended, reviewed and documented\n
so that less code is copied and pasted in dialog scripts.\n
\n
TODO: improve API and extensively document.\n
"""\n
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
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
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>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id=\'view\', keep_items={}, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>form_id</string>
<string>keep_items</string>
<string>kw</string>
<string>ZTUtils</string>
<string>make_query</string>
<string>_getattr_</string>
<string>context</string>
<string>request_form</string>
<string>redirect_url</string>
<string>dict</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>k</string>
<string>v</string>
<string>None</string>
<string>parameters</string>
<string>len</string>
<string>separator</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<string>view</string>
<dictionary/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_redirect</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -76,6 +76,8 @@ 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 = \'%s/view\' % (context.getPortalObject().absolute_url())\n
\n
......
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