Commit 2ccb5a9e authored by Łukasz Nowak's avatar Łukasz Nowak

Allow to pass (optional) destination.

parent 015b8ce6
...@@ -65,8 +65,10 @@ else:\n ...@@ -65,8 +65,10 @@ else:\n
portal_type = form_data[\'clone_portal_type\']\n portal_type = form_data[\'clone_portal_type\']\n
\n \n
# We copy contents in place if possible\n # We copy contents in place if possible\n
directory = getattr(context, \'original_container\', None) or context.getParentValue()\n source = getattr(context, \'original_container\', None) or context.getParentValue()\n
allowed_type_list = directory.getVisibleAllowedContentTypeList()\n if destination is None:\n
destination = source\n
allowed_type_list = destination.getVisibleAllowedContentTypeList()\n
if portal_type not in allowed_type_list:\n if portal_type not in allowed_type_list:\n
if batch_mode:\n if batch_mode:\n
return None\n return None\n
...@@ -91,14 +93,14 @@ if clone:\n ...@@ -91,14 +93,14 @@ if clone:\n
# Copy and paste the object\n # Copy and paste the object\n
original_id = getattr(context, \'original_id\', None) or context.getId()\n original_id = getattr(context, \'original_id\', None) or context.getId()\n
# This is required for objects acquired in Web Section\n # This is required for objects acquired in Web Section\n
clipboard = directory.manage_copyObjects(ids=[original_id])\n clipboard = source.manage_copyObjects(ids=[original_id])\n
context.REQUEST.set(\'__cp\', clipboard) # CopySupport is using this to set\n context.REQUEST.set(\'__cp\', clipboard) # CopySupport is using this to set\n
# tracebility information in edit_workflow history\n # tracebility information in edit_workflow history\n
paste_result = directory.manage_pasteObjects(cb_copy_data=clipboard)\n paste_result = destination.manage_pasteObjects(cb_copy_data=clipboard)\n
new_object = directory[paste_result[0][\'new_id\']]\n new_object = destination[paste_result[0][\'new_id\']]\n
message_kind = \'Clone\'\n message_kind = \'Clone\'\n
else:\n else:\n
new_object = directory.newContent(portal_type=portal_type)\n new_object = destination.newContent(portal_type=portal_type)\n
message_kind = \'New\'\n message_kind = \'New\'\n
\n \n
if web_mode:\n if web_mode:\n
...@@ -129,7 +131,7 @@ else:\n ...@@ -129,7 +131,7 @@ else:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>clone=1, form_id=\'view\', web_mode=0, editable_mode=0, batch_mode=0</string> </value> <value> <string>clone=1, form_id=\'view\', web_mode=0, editable_mode=0, batch_mode=0, destination=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
1086 1087
\ 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