Commit 1bc43667 authored by Kevin Deldycke's avatar Kevin Deldycke

Because of acquisition modification in the context of a website, getParent()...

Because of acquisition modification in the context of a website, getParent() returned a Domain object not the Web Page Module object.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8767 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f3a56d9b
...@@ -78,7 +78,8 @@ form_data = context.REQUEST.form\n ...@@ -78,7 +78,8 @@ form_data = context.REQUEST.form\n
context.log(\'WebSite_clone received REQUEST:\', form_data)\n context.log(\'WebSite_clone received REQUEST:\', form_data)\n
\n \n
# Here is the list of field name to ignore as property\n # Here is the list of field name to ignore as property\n
IGNORED_FORM_ID_LIST = [ # don\'t change id, else it would paste & setid in the same transaction.\n IGNORED_FORM_ID_LIST = [ \\\n
# don\'t change id, else it would paste & setid in the same transaction.\n
\'id\'\n \'id\'\n
# type of creation method\n # type of creation method\n
, \'document_action_mode\'\n , \'document_action_mode\'\n
...@@ -88,25 +89,28 @@ IGNORED_FORM_ID_LIST = [ # don\'t change id, else it would paste & setid in the ...@@ -88,25 +89,28 @@ IGNORED_FORM_ID_LIST = [ # don\'t change id, else it would paste & setid in the
, \'new_portal_type\', \'destination_section\'\n , \'new_portal_type\', \'destination_section\'\n
]\n ]\n
\n \n
directory = context.getParent()\n directory = context.restrictedTraverse(context.getRelativeUrl()).getParent()\n
creation_mode = form_data[\'document_action_mode\']\n creation_mode = form_data[\'document_action_mode\']\n
\n \n
\n \n
\n \n
# Standard cloning method\n # Standard cloning method\n
if creation_mode == \'clone\':\n if creation_mode == \'clone\':\n
# TODO?\n # TODO ?: If the document language hasn\'t changed and the version wasn\'t increased,\n
# if the document language hasn\'t changed and the version wasn\'t increased, change the copied document reference to "copy-of-%s"\n # change the copied document reference to "copy-of-%s". This idea came from\n
# To avoid confusion (invisible published cloned document due to duplicate document references in a given section), always modify the document\n # the fact some published document are "invisible" because cloned documents\n
# share by default the same reference (within a set of documents of same\n
# references in a given section, only one document is display).\n
\n
#context.log("Kev test context.getId >>>>>", repr(context.getId()))\n
#context.log("Kev test directory >>>>>", repr(directory))\n
\n \n
# Copy and paste the object\n # Copy and paste the object\n
clipboard = directory.manage_copyObjects(ids=[context.getId()])\n clipboard = directory.manage_copyObjects(ids=[context.getId()])\n
#context.log("Kev test clipboard >>>>>", repr(clipboard))\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
\n \n
#context.log("Kev test directory >>>>>", repr(directory))\n
#context.log("Kev test context.getI >>>>>", repr(context.getId()))\n
#context.log("Kev test clipboard >>>>>", repr(clipboard))\n
#context.log("Kev test paste_result >>>>>", repr(paste_result))\n #context.log("Kev test paste_result >>>>>", repr(paste_result))\n
#context.log("Kev test directory.WebSite_getUrl() >>>>>", repr(directory.WebSite_getUrl()))\n #context.log("Kev test directory.WebSite_getUrl() >>>>>", repr(directory.WebSite_getUrl()))\n
#context.log("Kev test new_object.getId() >>>>>", repr(new_object.getId()))\n #context.log("Kev test new_object.getId() >>>>>", repr(new_object.getId()))\n
......
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