Commit 697d3104 authored by Kevin Deldycke's avatar Kevin Deldycke

WebSite_newContent definitely replace WebSite_clone.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8699 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c02652db
<?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 encoding="cdata"><![CDATA[
directory = context.getParent()\n
clipboard = directory.manage_copyObjects(ids=[context.getId()])\n
paste_result = directory.manage_pasteObjects(cb_copy_data=clipboard)\n
dest = directory[paste_result[0][\'new_id\']]\n
\n
#Bad idea because it would paste & setid in the same transaction.\n
#if id is not None:\n
# directory.manage_renameObject(id=dest.getId(),new_id=id)\n
\n
#context.log(\'WebSite_clone\', context.REQUEST.form)\n
\n
for (key, val) in context.REQUEST.form.items():\n
if key != \'id\' and dest.hasProperty(key):\n
#context.log(\'WebSite_clone\',\'overwriting attr "%s" to value "%s"\' % (key,val))\n
dest.setProperty(key, val)\n
\n
return context.REQUEST.RESPONSE.redirect(\'%s/%s\' % (directory.WebSite_getUrl(), dest.getId()))\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>directory</string>
<string>clipboard</string>
<string>paste_result</string>
<string>_getitem_</string>
<string>dest</string>
<string>_getiter_</string>
<string>key</string>
<string>val</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>WebSite_clone</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -70,6 +70,10 @@ ...@@ -70,6 +70,10 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
"""\n
Create New Content by Cloning or Other Methods (replace old WebSite_clone).\n
"""\n
\n
form_data = context.REQUEST.form\n 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
...@@ -105,7 +109,7 @@ if creation_mode == \'clone\':\n ...@@ -105,7 +109,7 @@ if creation_mode == \'clone\':\n
#context.log("Kev test clipboard >>>>>", repr(clipboard))\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
\n \n
redirect_url = \'%s/%s/WebPage_view?editable_mode=1\' % (directory.WebSite_getUrl(), new_object.getId())\n redirect_url = \'%s/%s/WebPage_view?editable_mode=1\' % (directory.WebSite_getUrl(), new_object.getId())\n
\n \n
...@@ -142,7 +146,7 @@ elif creation_mode == \'clone_to\':\n ...@@ -142,7 +146,7 @@ elif creation_mode == \'clone_to\':\n
)\n )\n
\n \n
\n \n
# Create a new object here\n # Create a new object here (this is a copy and paste of the previous WebSite_clone script)\n
else:\n else:\n
# Get the new object portal type\n # Get the new object portal type\n
new_portal_type = context.REQUEST.form[\'new_portal_type\']\n new_portal_type = context.REQUEST.form[\'new_portal_type\']\n
...@@ -249,7 +253,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n ...@@ -249,7 +253,7 @@ return context.REQUEST.RESPONSE.redirect(redirect_url)\n
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Create New Content by Cloning or Other Methods (replace old WebSite_clone)</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
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