Commit b4de995a authored by Romain Courteaud's avatar Romain Courteaud

Add a batch_mode parameter to Base_createCloneDocument to prevent redirection...

Add a batch_mode parameter to Base_createCloneDocument to prevent redirection (if called from another python script for example)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19838 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d4c709cd
......@@ -85,10 +85,13 @@ else:\n
parent = context.getParentValue()\n
allowed_type_list = parent.getVisibleAllowedContentTypeList()\n
if portal_type not in allowed_type_list:\n
return context.ERP5Site_redirect(\'%s/%s/view\' % (\n
parent.getUrl(), context.getId()),\n
keep_items={\'portal_status_message\':\n
translateString("You are not allowed to clone this object.")})\n
if batch_mode:\n
return None\n
else:\n
return context.ERP5Site_redirect(\'%s/%s/view\' % (\n
parent.getUrl(), context.getId()),\n
keep_items={\'portal_status_message\':\n
translateString("You are not allowed to clone this object.")})\n
\n
# prepare query params\n
kw = {\'portal_type\' : translateString(portal_type)}\n
......@@ -105,12 +108,15 @@ if clone:\n
new_object = directory[paste_result[0][\'new_id\']]\n
message_kind = \'Clone\'\n
\n
if not editable_mode: \n
form_id = \'view\'\n
msg = translateString("Created %s ${portal_type}." % message_kind, mapping = kw)\n
return new_object.Base_redirect(form_id, \n
editable_mode=1,\n
keep_items={\'portal_status_message\': msg})\n
if batch_mode:\n
return new_object\n
else:\n
if not editable_mode: \n
form_id = \'view\'\n
msg = translateString("Created %s ${portal_type}." % message_kind, mapping = kw)\n
return new_object.Base_redirect(form_id, \n
editable_mode=1,\n
keep_items={\'portal_status_message\': msg})\n
</string> </value>
</item>
<item>
......@@ -127,7 +133,7 @@ return new_object.Base_redirect(form_id, \n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>clone=1, form_id, editable_mode=0</string> </value>
<value> <string>clone=1, form_id, editable_mode=0, batch_mode=0</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......@@ -153,7 +159,7 @@ return new_object.Base_redirect(form_id, \n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>3</int> </value>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -162,6 +168,7 @@ return new_object.Base_redirect(form_id, \n
<string>clone</string>
<string>form_id</string>
<string>editable_mode</string>
<string>batch_mode</string>
<string>_getattr_</string>
<string>context</string>
<string>translateString</string>
......@@ -170,9 +177,9 @@ return new_object.Base_redirect(form_id, \n
<string>_getitem_</string>
<string>parent</string>
<string>allowed_type_list</string>
<string>None</string>
<string>kw</string>
<string>getattr</string>
<string>None</string>
<string>directory</string>
<string>original_id</string>
<string>clipboard</string>
......@@ -195,6 +202,7 @@ return new_object.Base_redirect(form_id, \n
<int>1</int>
<none/>
<int>0</int>
<int>0</int>
</tuple>
</value>
</item>
......
502
\ No newline at end of file
503
\ 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