Commit 0b3aea76 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* respect original_container if specified, otherwise it does not work fine...

* respect original_container if specified, otherwise it does not work fine with erp5_web where a document is accessed through its reference.
* implement non-clone case logic that is required for erp5_web.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27203 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d06f1dda
...@@ -67,8 +67,9 @@ if clone:\n ...@@ -67,8 +67,9 @@ if clone:\n
else:\n else:\n
portal_type = form_data[\'clone_portal_type\']\n portal_type = form_data[\'clone_portal_type\']\n
\n \n
parent = context.getParentValue()\n # We copy contents in place if possible\n
allowed_type_list = parent.getVisibleAllowedContentTypeList()\n directory = getattr(context, \'original_container\', None) or context.getParentValue()\n
allowed_type_list = directory.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
...@@ -90,8 +91,6 @@ if web_mode:\n ...@@ -90,8 +91,6 @@ if web_mode:\n
\n \n
# Standard cloning method\n # Standard cloning method\n
if clone:\n if clone:\n
# We copy contents in place if possible\n
directory = getattr(context, \'original_container\', None) or context.getParentValue()\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
...@@ -99,6 +98,9 @@ if clone:\n ...@@ -99,6 +98,9 @@ if clone:\n
paste_result = directory.manage_pasteObjects(cb_copy_data=clipboard)\n paste_result = directory.manage_pasteObjects(cb_copy_data=clipboard)\n
new_object = directory[paste_result[0][\'new_id\']]\n new_object = directory[paste_result[0][\'new_id\']]\n
message_kind = \'Clone\'\n message_kind = \'Clone\'\n
else:\n
new_object = directory.newContent(portal_type=portal_type)\n
message_kind = \'New\'\n
\n \n
if web_mode:\n if web_mode:\n
# Edit the objects with some properties\n # Edit the objects with some properties\n
...@@ -177,15 +179,14 @@ else:\n ...@@ -177,15 +179,14 @@ else:\n
<string>form_data</string> <string>form_data</string>
<string>portal_type</string> <string>portal_type</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>parent</string> <string>getattr</string>
<string>allowed_type_list</string>
<string>None</string> <string>None</string>
<string>directory</string>
<string>allowed_type_list</string>
<string>kw</string> <string>kw</string>
<string>getattr</string>
<string>script</string> <string>script</string>
<string>_apply_</string> <string>_apply_</string>
<string>msg</string> <string>msg</string>
<string>directory</string>
<string>original_id</string> <string>original_id</string>
<string>clipboard</string> <string>clipboard</string>
<string>paste_result</string> <string>paste_result</string>
......
758 759
\ 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