Commit 0be251b8 authored by Vincent Pelletier's avatar Vincent Pelletier

Use keep_items parameter of ERP5XhtmlStyle_redirect to pass the portal_status_message.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9035 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f86ccde0
<?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>N_ = context.getPortalObject().Base_translateString\n
REQUEST=context.REQUEST\n
\n
# Add an object of the same type as self in the container.\n
parent = context.aq_parent\n
\n
# XXX May be this need to be changed in order to get something else than\n
# the permission "Add portal content"\n
new_id = parent.generateNewId()\n
context.portal_types.constructContent(type_name=context.portal_type,\n
container=parent,\n
id=str(new_id),\n
RESPONSE=REQUEST.RESPONSE)\n
\n
return context.ERP5XhtmlStyle_redirect(\'%s/%s/view\' % (parent.getUrl(), new_id), keep_items={\'portal_status_message\': N_("Object Created.")})\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>_params</string> </key>
<value> <string></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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>N_</string>
<string>REQUEST</string>
<string>parent</string>
<string>new_id</string>
<string>str</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_createNewDocument</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n N_ = portal.Base_translateString\n
preserved_parameters={}\n
\n \n
Base_doAction = select_action.split()\n Base_doAction = select_action.split()\n
doAction0 = Base_doAction[0]\n doAction0 = Base_doAction[0]\n
...@@ -77,13 +78,14 @@ request = context.REQUEST\n ...@@ -77,13 +78,14 @@ request = context.REQUEST\n
\n \n
# Reinject parameters in kw\n # Reinject parameters in kw\n
kw[\'selection_name\']=selection_name\n kw[\'selection_name\']=selection_name\n
kw[\'uids\']=uids\n #uids=None, listbox_uid=None\n
kw[\'listbox_uid\']=listbox_uid\n #kw[\'uids\']=uids\n
#kw[\'listbox_uid\']=listbox_uid\n
kw[\'ignore_layout\']=ignore_layout\n kw[\'ignore_layout\']=ignore_layout\n
\n \n
# Update checked uids\n # Update checked uids\n
if None not in (selection_name, uids, listbox_uid):\n #if None not in (selection_name, uids, listbox_uid):\n
context.portal_selections.updateSelectionCheckedUidList(selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)\n # context.portal_selections.updateSelectionCheckedUidList(selection_name, uids=uids, listbox_uid=listbox_uid, REQUEST=request)\n
\n \n
# If this is an object, a workflow or a folder, then jump to that view\n # If this is an object, a workflow or a folder, then jump to that view\n
if doAction0 in (\'object\', \'workflow\', \'folder\'):\n if doAction0 in (\'object\', \'workflow\', \'folder\'):\n
...@@ -97,7 +99,7 @@ elif doAction0 == \'add\':\n ...@@ -97,7 +99,7 @@ elif doAction0 == \'add\':\n
new_content = context.newContent(portal_type=type_name,\n new_content = context.newContent(portal_type=type_name,\n
container=context,\n container=context,\n
id=str(new_id))\n id=str(new_id))\n
kw[\'portal_status_message\'] = N_("Object+Created.")\n preserved_parameters[\'portal_status_message\'] = N_("Object Created.")\n
if not(ignore_layout) and context.getApplicableLayout():\n if not(ignore_layout) and context.getApplicableLayout():\n
kw[\'editable_mode\'] = 1\n kw[\'editable_mode\'] = 1\n
redirect_url = \'%s/view\' % (new_content.WebSite_getDocumentPhysicalPath(), )\n redirect_url = \'%s/view\' % (new_content.WebSite_getDocumentPhysicalPath(), )\n
...@@ -117,16 +119,16 @@ elif doAction0 == \'template\':\n ...@@ -117,16 +119,16 @@ elif doAction0 == \'template\':\n
new_content_id = new_content_list[0][\'new_id\']\n new_content_id = new_content_list[0][\'new_id\']\n
new_content = context[new_content_id]\n new_content = context[new_content_id]\n
new_content.makeTemplateInstance()\n new_content.makeTemplateInstance()\n
kw[\'portal_status_message\'] = N_("Template+Created.")\n preserved_parameters[\'portal_status_message\'] = N_("Template Created.")\n
redirect_url = \'%s/view\' % ( new_content.absolute_url(), )\n redirect_url = \'%s/view\' % ( new_content.absolute_url(), )\n
else:\n else:\n
kw[\'portal_status_message\'] = N_("Template+Does+not+Exist.")\n preserved_parameters[\'portal_status_message\'] = N_("Template Does not Exist.")\n
redirect_url = \'%s/view\' % (context.absolute_url(), )\n redirect_url = \'%s/view\' % (context.absolute_url(), )\n
else:\n else:\n
redirect_url = request[\'ACTUAL_URL\']\n redirect_url = request[\'ACTUAL_URL\']\n
kw[\'portal_status_message\'] = N_(\'Error: the action "%s" is not recognised.\' % (doAction0, ))\n preserved_parameters[\'portal_status_message\'] = N_(\'Error: the action "%s" is not recognised.\' % (doAction0, ))\n
\n \n
return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n return context.ERP5XhtmlStyle_redirect(redirect_url, keep_items=preserved_parameters, **kw)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -143,7 +145,7 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n ...@@ -143,7 +145,7 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>select_action, selection_name=None, uids=None, listbox_uid=None, ignore_layout=None, **kw</string> </value> <value> <string>select_action, selection_name=None, ignore_layout=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -163,7 +165,7 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n ...@@ -163,7 +165,7 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>5</int> </value> <value> <int>3</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -171,25 +173,24 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n ...@@ -171,25 +173,24 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n
<tuple> <tuple>
<string>select_action</string> <string>select_action</string>
<string>selection_name</string> <string>selection_name</string>
<string>uids</string>
<string>listbox_uid</string>
<string>ignore_layout</string> <string>ignore_layout</string>
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
<string>N_</string> <string>N_</string>
<string>preserved_parameters</string>
<string>Base_doAction</string> <string>Base_doAction</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>doAction0</string> <string>doAction0</string>
<string>request</string> <string>request</string>
<string>_write_</string> <string>_write_</string>
<string>None</string>
<string>redirect_url</string> <string>redirect_url</string>
<string>new_id</string> <string>new_id</string>
<string>type_name</string> <string>type_name</string>
<string>str</string> <string>str</string>
<string>new_content</string> <string>new_content</string>
<string>None</string>
<string>template_relative_url</string> <string>template_relative_url</string>
<string>template</string> <string>template</string>
<string>preference</string> <string>preference</string>
...@@ -210,8 +211,6 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n ...@@ -210,8 +211,6 @@ return context.ERP5XhtmlStyle_redirect(redirect_url, **kw)\n
<tuple> <tuple>
<none/> <none/>
<none/> <none/>
<none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?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>N_ = context.getPortalObject().Base_translateString\n
\n
# Add an object of the same type as the container\n
# or if allowed content types is 1 add that type\n
try:\n
new_object = context.newContent()\n
except IndexError:\n
# return only a portal_status_message if the IndexError is raised because\n
# there are no elemnts in context.allowedContentTypes()\n
if not context.allowedContentTypes():\n
return context.ERP5XhtmlStyle_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n
else:\n
raise\n
\n
return context.ERP5XhtmlStyle_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': N_("Object Created.")})\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>_params</string> </key>
<value> <string></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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>N_</string>
<string>new_object</string>
<string>IndexError</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Folder_create</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
70 72
\ No newline at end of file \ 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