Commit 3440eca0 authored by Rafael Monnerat's avatar Rafael Monnerat

Removed migration scripts from official business template.

The page http://www.erp5.org/UpgradeNote was updated and this scripts was moved to:

http://www.erp5.org/UpgradeNote?action=AttachFile&do=view&target=erp5_bug_migration-0.1.bt5

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23842 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dae189dd
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</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>for bug in context.searchFolder():\n
bug.activate().Bug_migrate()\n
\n
return "Activities Created Successfully."\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>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>bug</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>BugModule_migrate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</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[
# This script is used to only migrate Items to new bug implementation.\n
# Set reference\n
context.setReference("#%s" % (context.getId()))\n
\n
# Now Source is Source Trade\n
source = context.getSource()\n
context.setSourceTrade(source)\n
context.setSourceValue(None)\n
\n
# bug_type becomes resouce\n
bug_type = context.getBugType()\n
context.setResource(bug_type)\n
context.setBugType(None)\n
\n
# Now Destination is Source\n
destination = context.getDestination()\n
context.setSource(destination)\n
context.setDestinationValue(None)\n
\n
bug_history = context.Base_getWorkflowHistoryItemList(workflow_id="bug_workflow")\n
\n
valid_action_transitions = ["close_action" , "open_action", "reopen_action", "follow_action", "cancel" ]\n
history_list = [ac for ac in bug_history if ac.action in valid_action_transitions ]\n
\n
for message in history_list:\n
if message.action == "follow_action":\n
bug_message_title = "This bug was Follow up"\n
if message.action == "open_action":\n
bug_message_title = "This bug was Open"\n
if message.action == "close_action":\n
bug_message_title = "This bug was Closed"\n
if message.action == "reopen_action":\n
bug_message_title = "This bug was Reopen"\n
if message.action == "cancel":\n
bug_message_title = "This bug was Cancelled"\n
\n
\n
bug_message = context.newContent(title=bug_message_title, \n
portal_type="Bug Line")\n
person_list = context.acl_users.erp5_users.getUserByLogin(message.actor)\n
bug_message.setSourceValueList(person_list)\n
bug_message.setTextContent(message.comment)\n
bug_message.setStartDate(message.time)\n
bug_message.start()\n
\n
# Migration States\n
for index in range(len(bug_history)):\n
history_item = bug_history[-(index+1)]\n
if history_item.action in [\'open\', \'reopen\', \'close\' , "cancel"]:\n
context.confirm()\n
if history_item.action in [\'reopen\', \'close\']:\n
context.portal_workflow.doActionFor(context, \'set_ready_action\')\n
if history_item.action in [\'close\']:\n
context.portal_workflow.doActionFor(context, \'stop_action\')\n
if history_item.action in [\'cancel\']:\n
context.cancel()\n
if history_item.action in [\'open\', \'reopen\', \'close\', \'cancel\']:\n
break\n
\n
#Migration of Files\n
file_list = context.searchFolder(portal_type=["File","Image"])\n
if len(file_list) > 0:\n
default_bug_line = context.newContent(id="default_bug_line", \n
portal_type="Bug Line",\n
title="Default Bug Line")\n
\n
idlist = [file.getId() for file in file_list]\n
clipboard = context.manage_cutObjects(ids=idlist)\n
context.default_bug_line.manage_pasteObjects(cb_copy_data=clipboard)\n
context.log("Files moved in %s" % (context.getReference()))\n
context.log("%s Bug Migrated." % (context.getReference()))\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>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>source</string>
<string>None</string>
<string>bug_type</string>
<string>destination</string>
<string>bug_history</string>
<string>valid_action_transitions</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>ac</string>
<string>history_list</string>
<string>message</string>
<string>bug_message_title</string>
<string>bug_message</string>
<string>person_list</string>
<string>range</string>
<string>len</string>
<string>index</string>
<string>_getitem_</string>
<string>history_item</string>
<string>file_list</string>
<string>default_bug_line</string>
<string>file</string>
<string>idlist</string>
<string>clipboard</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>Bug_migrate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
372 375
\ 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