Commit cae42184 authored by Yusei Tahara's avatar Yusei Tahara

2008-10-24 yusei

* Cleaned up Base_getTranslatedWorkflowStateItemList and separate generic function to Base_getWorkflowStateItemList.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24320 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6bf5fa58
No related merge requests found
......@@ -53,32 +53,22 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># wf_id : the id of workflow. It can be string, list or tuple.\n
from Products.CMFCore.utils import getToolByName\n
<value> <string># wf_id is a bad argument name. But I will keep this for backward compatibility.\n
# wf_id : the id of workflow. It can be string, list or tuple.\n
\n
Base_translateString = context.Base_translateString\n
\n
\n
if same_type(wf_id, []) or same_type(wf_id, ()):\n
wf_id_list = wf_id\n
workflow_id_list = wf_id\n
else:\n
wf_id_list = [wf_id]\n
\n
state_dict = {}\n
item_list = []\n
for wf_id in wf_id_list:\n
\n
wf = getToolByName(context, \'portal_workflow\')[wf_id]\n
workflow_id_list = [wf_id]\n
\n
result = []\n
for state_title, state_id in context.Base_getWorkflowStateItemList(workflow_id_list=workflow_id_list):\n
translated_state_title = Base_translateString(state_title)\n
result.append((translated_state_title, state_id))\n
\n
for state in wf.states.objectValues():\n
if state.title and state.id != \'deleted\':\n
if not state_dict.has_key(state.id):\n
# we hide states without titles\n
item_list.append((Base_translateString(state.title), state.id))\n
state_dict[state.id] = None\n
\n
return item_list\n
return result\n
</string> </value>
</item>
<item>
......@@ -94,11 +84,7 @@ return item_list\n
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
<string>Manager</string>
<string>Member</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -126,21 +112,16 @@ return item_list\n
<value>
<tuple>
<string>wf_id</string>
<string>Products.CMFCore.utils</string>
<string>getToolByName</string>
<string>_getattr_</string>
<string>context</string>
<string>Base_translateString</string>
<string>same_type</string>
<string>wf_id_list</string>
<string>state_dict</string>
<string>item_list</string>
<string>workflow_id_list</string>
<string>result</string>
<string>_getiter_</string>
<string>_getitem_</string>
<string>wf</string>
<string>state</string>
<string>None</string>
<string>_write_</string>
<string>state_title</string>
<string>state_id</string>
<string>translated_state_title</string>
</tuple>
</value>
</item>
......
<?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>Script_magic</string> </key>
<value> <int>3</int> </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>from Products.CMFCore.utils import getToolByName\n
\n
if not (same_type(workflow_id_list, []) or same_type(workflow_id_list, ())):\n
workflow_id_list = (workflow_id_list,)\n
\n
state_dict = {}\n
item_list = []\n
for workflow_id in workflow_id_list:\n
workflow = getToolByName(context, \'portal_workflow\')[workflow_id]\n
for state in workflow.states.objectValues():\n
if state.title and state.id!=\'deleted\':\n
if not state_dict.has_key(state.id):\n
# we hide states without titles\n
item_list.append((state.title, state.id))\n
state_dict[state.id] = None\n
return item_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>workflow_id_list</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Auditor</string>
<string>Manager</string>
<string>Member</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>workflow_id_list</string>
<string>Products.CMFCore.utils</string>
<string>getToolByName</string>
<string>same_type</string>
<string>state_dict</string>
<string>item_list</string>
<string>_getiter_</string>
<string>workflow_id</string>
<string>_getitem_</string>
<string>context</string>
<string>workflow</string>
<string>_getattr_</string>
<string>state</string>
<string>None</string>
<string>_write_</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>Base_getWorkflowStateItemList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2008-10-24 yusei
* Cleaned up Base_getTranslatedWorkflowStateItemList and separate generic function to Base_getWorkflowStateItemList.
2008-10-24 yusei
* Fixed Folder_generateWorkflowReport. This did not work if there is interaction workflow.
......
1004
\ No newline at end of file
1005
\ 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