Commit 47f6d244 authored by Sebastien Robin's avatar Sebastien Robin

2008-05-15 Seb

* Base_getTranslatedWorkflowStateItemList can now support a list for wf_id

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21281 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 686b05d4
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -68,16 +65,30 @@ ...@@ -68,16 +65,30 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.CMFCore.utils import getToolByName\n <value> <string># wf_id : the id of workflow. It can be string, list or tuple.\n
from Products.CMFCore.utils import getToolByName\n
\n \n
N_ = context.Base_translateString\n N_ = context.Base_translateString\n
wf = getToolByName(context, \'portal_workflow\')[wf_id]\n \n
\n
if same_type(wf_id, []) or same_type(wf_id, ()):\n
wf_id_list = wf_id\n
else:\n
wf_id_list = [wf_id]\n
\n
state_dict = {}\n
item_list = []\n item_list = []\n
for wf_id in wf_id_list:\n
\n
wf = getToolByName(context, \'portal_workflow\')[wf_id]\n
\n
\n \n
for state in wf.states.objectValues():\n for state in wf.states.objectValues():\n
if state.title and state.id != \'deleted\':\n if state.title and state.id != \'deleted\':\n
# we hide states without titles\n if not state_dict.has_key(state.id):\n
item_list.append((N_(state.title), state.id))\n # we hide states without titles\n
item_list.append((N_(state.title), state.id))\n
state_dict[state.id] = None\n
\n \n
return item_list\n return item_list\n
</string> </value> </string> </value>
...@@ -138,11 +149,16 @@ return item_list\n ...@@ -138,11 +149,16 @@ return item_list\n
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>N_</string> <string>N_</string>
<string>_getitem_</string> <string>same_type</string>
<string>wf</string> <string>wf_id_list</string>
<string>state_dict</string>
<string>item_list</string> <string>item_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>_getitem_</string>
<string>wf</string>
<string>state</string> <string>state</string>
<string>None</string>
<string>_write_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
827 828
\ 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