Commit 495d6539 authored by Vincent Pelletier's avatar Vincent Pelletier

Cleanup ERP5XhtmlStyle_filterParameterList.

Remove variable names from explicit propagation, because they must be generated explicitely in the page templates which require them. Further cleanup is still required for some of the remaining names.
Add explicit rendering of variables whose name were removed from filter script.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10682 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d00a5dbe
......@@ -48,7 +48,7 @@
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<tal:block metal:use-macro="here/form_dialog/macros/master" />\n
<tal:block metal:use-macro="here/relation_form/macros/master" />\n
]]></string> </value>
......
......@@ -70,7 +70,7 @@
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
preserved_parameters={}\n
preserved_parameters={\'form_id\': form_id, \'cancel_url\': cancel_url}\n
request = context.REQUEST\n
\n
Base_doAction = select_action.split()\n
......@@ -135,7 +135,7 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, keep_items=preserved_parame
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>select_action, **kw</string> </value>
<value> <string>select_action, form_id, cancel_url, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -155,13 +155,15 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, keep_items=preserved_parame
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>select_action</string>
<string>form_id</string>
<string>cancel_url</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
......
......@@ -68,7 +68,8 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>return context.ERP5XhtmlStyle_redirect(select_dialog.split()[0], keep_items={\'dialog_category\': dialog_category}, **kw)\n
<value> <string>kw.update(context.REQUEST.form)\n
return context.ERP5XhtmlStyle_redirect(select_dialog.split()[0], keep_items={\'dialog_category\': dialog_category, \'form_id\': form_id, \'cancel_url\': cancel_url}, **kw)\n
</string> </value>
</item>
<item>
......@@ -91,7 +92,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>select_dialog, dialog_category, **kw</string> </value>
<value> <string>select_dialog, dialog_category, form_id, cancel_url, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -111,7 +112,7 @@
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -119,10 +120,12 @@
<tuple>
<string>select_dialog</string>
<string>dialog_category</string>
<string>form_id</string>
<string>cancel_url</string>
<string>kw</string>
<string>_apply_</string>
<string>_getattr_</string>
<string>context</string>
<string>_apply_</string>
<string>_getitem_</string>
</tuple>
</value>
......
......@@ -70,11 +70,7 @@
<key> <string>_body</string> </key>
<value> <string>kept_names = (\'editable_mode\', \'ignore_layout\', # erp5_web\n
\'selection_name\', \'selection_index\', # list mode\n
\'form_id\', # list mode and view mode\n
\'object_uid\', \'object_path\', # view mode\n
\'field_id\', \'form_pickle\', \'form_signature\', # related string field\n
\'bt_list\', # business template installation system\n
\'cancel_url\',\n
)\n
# Dialog mode is absent from the kept_name list on purpose :\n
# none of its variable should ever get transmited because\n
......@@ -83,20 +79,8 @@
# a dialog. So this is safe to propagate it.\n
\n
kept_names = dict([(key, None) for key in kept_names])\n
\n
def isValid(value_name):\n
"""\n
Return true when the given field name can be propagated, false otherwise.\n
"""\n
if kept_names.has_key(value_name):\n
return True\n
return False\n
\n
for k in parameter_list.keys():\n
if not isValid(k):\n
del parameter_list[k]\n
\n
return parameter_list\n
to_keep = kept_names.has_key\n
return dict([(k, v) for k, v in parameter_list.items() if to_keep(k)])\n
</string> </value>
</item>
<item>
......@@ -147,10 +131,10 @@ return parameter_list\n
<string>_getiter_</string>
<string>key</string>
<string>None</string>
<string>isValid</string>
<string>_getattr_</string>
<string>to_keep</string>
<string>k</string>
<string>_write_</string>
<string>v</string>
</tuple>
</value>
</item>
......
......@@ -77,7 +77,7 @@ if len(print_action_list) == 0:\n
if len(print_action_list) == 1:\n
return context.ERP5XhtmlStyle_redirect(print_action_list[0][\'url\'], **kw)\n
else:\n
return context.ERP5XhtmlStyle_redirect(\'%s/Base_print\' % (context.absolute_url(), ), keep_items={\'dialog_category\': \'object_print\'}, **kw)\n
return context.ERP5XhtmlStyle_redirect(\'%s/Base_print\' % (context.absolute_url(), ), keep_items={\'dialog_category\': \'object_print\', \'form_id\': form_id, \'cancel_url\': cancel_url}, **kw)\n
</string> </value>
</item>
<item>
......@@ -94,7 +94,7 @@ else:\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id, **kw</string> </value>
<value> <string>form_id, cancel_url, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -114,13 +114,14 @@ else:\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>form_id</string>
<string>cancel_url</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
......
......@@ -72,7 +72,8 @@
# Clear selection\n
context.portal_selections.setSelectionCheckedUidsFor(\'template_tool_install_selection\', [])\n
# Then call the listbox\n
return context.ERP5XhtmlStyle_redirect("%s/%s" % (context.absolute_url(), \'TemplateTool_viewInstallRepositoryBusinessTemplateListDialog\'), keep_items={\'dialog_category\': dialog_category}, **kw)\n
kw.update(context.REQUEST.form)\n
return context.ERP5XhtmlStyle_redirect("%s/%s" % (context.absolute_url(), \'TemplateTool_viewInstallRepositoryBusinessTemplateListDialog\'), keep_items={\'dialog_category\': dialog_category, \'form_id\': form_id, \'cancel_url\': cancel_url}, **kw)\n
</string> </value>
</item>
<item>
......@@ -95,7 +96,7 @@ return context.ERP5XhtmlStyle_redirect("%s/%s" % (context.absolute_url(), \'Temp
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>dialog_category=None, **kw</string> </value>
<value> <string>dialog_category=None, form_id, cancel_url, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -115,13 +116,15 @@ return context.ERP5XhtmlStyle_redirect("%s/%s" % (context.absolute_url(), \'Temp
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>dialog_category</string>
<string>form_id</string>
<string>cancel_url</string>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
......@@ -139,6 +142,8 @@ return context.ERP5XhtmlStyle_redirect("%s/%s" % (context.absolute_url(), \'Temp
<value>
<tuple>
<none/>
<none/>
<none/>
</tuple>
</value>
</item>
......
......@@ -75,12 +75,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
<tal:block metal:define-macro="master">\n
<tal:block tal:define="form_action string:Base_callDialogMethod;\n
dialog_id form/id | template/id;\n
form_id request/form_id | string:view;\n
dialog_method form/action | dialog_id;\n
update_action form/update_action;\n
global dialog_category request/dialog_category | nothing;\n
\n
local_parameter_list local_parameter_list | python: {};\n
dummy python: local_parameter_list.update({\'dialog_id\': dialog_id, \'dialog_method\': dialog_method, \'update_method\': update_action, \'dialog_category\': dialog_category});\n
dummy python: local_parameter_list.update({\'dialog_id\': dialog_id, \'dialog_method\': dialog_method, \'update_method\': update_action, \'dialog_category\': dialog_category, \'cancel_url\': request.get(\'cancel_url\'), \'form_id\': form_id});\n
title form/title">\n
<tal:block metal:use-macro="here/main_template/macros/master">\n
<tal:block metal:fill-slot="main">\n
......
......@@ -67,8 +67,7 @@
global js_list js_list | python: [];\n
dummy python: js_list.extend([\'%s/%s\' % (here.portal_url.getPortalPath(), x) for x in here.ERP5XhtmlStyle_getJSList()]);\n
\n
global http_parameter_list request/form/copy;\n
http_parameter_list python: here.ERP5XhtmlStyle_filterParameterList(http_parameter_list);\n
global http_parameter_list python: here.ERP5XhtmlStyle_filterParameterList(request.form);\n
dummy python: http_parameter_list.update(local_parameter_list);\n
global http_parameters python: here.ERP5XhtmlStyle_renderHTTPParameterList(http_parameter_list);\n
global form nocall:form | nothing;\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<tal:block tal:replace="nothing"\n
xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<!--\n
Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.\n
Vincent Pelletier <vincent@nexedi.com>\n
Christophe Dumez <christophe@nexedi.com>\n
\n
This program is Free Software; you can redistribute it and/or\n
modify it under the terms of the GNU General Public License\n
as published by the Free Software Foundation; either version 2\n
of the License, or (at your option) any later version.\n
\n
This program is distributed in the hope that it will be useful,\n
but WITHOUT ANY WARRANTY; without even the implied warranty of\n
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n
GNU General Public License for more details.\n
\n
You should have received a copy of the GNU General Public License\n
along with this program; if not, write to the Free Software\n
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
-->\n
</tal:block>\n
<tal:block metal:define-macro="master">\n
<tal:block tal:define="local_parameter_list local_parameter_list | python: {};\n
dummy python: local_parameter_list.update({\'field_id\': request[\'field_id\'], \'form_pickle\': request[\'form_pickle\'], \'form_signature\': request[\'form_signature\']});">\n
<tal:block metal:use-macro="here/form_dialog/macros/master" />\n
</tal:block>\n
</tal:block>\n
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>relation_form</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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