Commit 68e679d8 authored by Rafael Monnerat's avatar Rafael Monnerat

Fix Name Convention and portal id usage

- No Plural on Script Names
- The script were using "/erp5/web_page_module" to access the modules instead use clever API.
parent a66f040e
......@@ -50,15 +50,19 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if conv_obj_type == \'Web Page\':\n
conv_module_path = \'/erp5/web_page_module\'\n
else:\n
conv_module_path = \'/erp5/test_page_module\'\n
conv_obj_module = context.restrictedTraverse(conv_module_path)\n
<value> <string># XXX (rafael) I beleave KM has a much better way to do this, \n
# clone web page.\n
\n
conv_module_id = \'test_page_module\'\n
\n
if conv_obj_type == \'Web Page\':\n
conv_module_id = \'web_page_module\'\n
\n
conv_obj_module = context.getDefaultModule(conv_obj_type)\n
counter = 0\n
for uid in uids:\n
counter += 1\n
obj = context.portal_catalog(uid=uid)[0]\n
obj = context.portal_catalog.getResultValue(uid=uid)\n
conv_obj = conv_obj_module.newContent(portal_type = conv_obj_type,\n
title = obj.getTitle(),\n
short_title = obj.getShortTitle(),\n
......@@ -72,11 +76,10 @@ for uid in uids:\n
text_content = obj.getTextContent(),\n
format = obj.getFormat(),\n
contributor_list = obj.getContributorList())\n
try:\n
context.restrictedTraverse(conv_module_path)\n
except:\n
conv_obj.setId(obj.getId())\n
conv_obj = conv_obj.manage_pasteObjects(obj.manage_copyObjects(map(lambda x: x.getId(), obj.objectValues())))\n
\n
conv_obj = conv_obj.manage_pasteObjects(\n
obj.manage_copyObjects(\n
map(lambda x: x.getId(), obj.objectValues())))\n
\n
return conv_obj_module.Base_redirect(\'\', dict(portal_status_message=context.Base_translateString(str(counter) + " object(s) converted.")))\n
</string> </value>
......@@ -87,7 +90,7 @@ return conv_obj_module.Base_redirect(\'\', dict(portal_status_message=context.Ba
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPageModule_convertPages</string> </value>
<value> <string>TestPageModule_convertPage</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>return context.TestPageModule_convertPages(uids, \'Web Page\')\n
<value> <string>return context.TestPageModule_convertPage(uids, \'Test Page\')\n
</string> </value>
</item>
<item>
......@@ -59,7 +59,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPageModule_convertToWebPages</string> </value>
<value> <string>TestPageModule_convertToTestPage</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>return context.TestPageModule_convertPages(uids, \'Test Page\')\n
<value> <string>return context.TestPageModule_convertPage(uids, \'Web Page\')\n
</string> </value>
</item>
<item>
......@@ -59,7 +59,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPageModule_convertToTestPages</string> </value>
<value> <string>TestPageModule_convertToWebPage</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>TestPageModule_convertToTestPages</string> </value>
<value> <string>TestPageModule_convertToTestPage</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>TestPageModule_convertToWebPages</string> </value>
<value> <string>TestPageModule_convertToWebPage</string> </value>
</item>
<item>
<key> <string>description</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