Get rid of pointless "check before you leap" uses of...

Get rid of pointless "check before you leap" uses of portal_workflow.getActionsFor(), which, by the way, has disappeared from CMF 2

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32080 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e250f6cb
...@@ -54,19 +54,18 @@ ...@@ -54,19 +54,18 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.CMFCore.WorkflowCore import WorkflowException\n
\n \n
o = context.getObject()\n o = context.getObject()\n
\n \n
action_list = context.portal_workflow.getActionsFor(o)\n if 1: # keep indentation\n
action_list = filter(lambda x:x.has_key(\'id\'), action_list )\n
action_id_list = map(lambda x:x[\'id\'], action_list)\n
\n
if workflow_action in action_id_list:\n
try : \n try : \n
context.portal_workflow.doActionFor( o,\n context.portal_workflow.doActionFor( o,\n
workflow_action,\n workflow_action,\n
comment=comment,\n comment=comment,\n
**kw)\n **kw)\n
except WorkflowException:\n
pass\n
except ValidationFailed, message:\n except ValidationFailed, message:\n
if getattr(message, \'msg\', None) and same_type(message.msg, []):\n if getattr(message, \'msg\', None) and same_type(message.msg, []):\n
message = \'. \'.join(\'%s\' % x for x in message.msg)\n message = \'. \'.join(\'%s\' % x for x in message.msg)\n
...@@ -116,13 +115,11 @@ if workflow_action in action_id_list:\n ...@@ -116,13 +115,11 @@ if workflow_action in action_id_list:\n
<string>kw</string> <string>kw</string>
<string>Products.DCWorkflow.DCWorkflow</string> <string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.CMFCore.WorkflowCore</string>
<string>WorkflowException</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>o</string> <string>o</string>
<string>action_list</string>
<string>filter</string>
<string>map</string>
<string>action_id_list</string>
<string>_apply_</string> <string>_apply_</string>
<string>message</string> <string>message</string>
<string>getattr</string> <string>getattr</string>
......
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
from ZODB.POSException import ConflictError\n from ZODB.POSException import ConflictError\n
from Products.CMFCore.WorkflowCore import WorkflowException\n
\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
Base_translateString = portal.Base_translateString\n Base_translateString = portal.Base_translateString\n
\n \n
...@@ -146,11 +148,13 @@ elif uids is not None:\n ...@@ -146,11 +148,13 @@ elif uids is not None:\n
object_ids = [x.getId() for x in object_to_remove_list]\n object_ids = [x.getId() for x in object_to_remove_list]\n
comment = Base_translateString(\'Deleted objects: ${object_ids}\',\n comment = Base_translateString(\'Deleted objects: ${object_ids}\',\n
mapping={\'object_ids\': object_ids})\n mapping={\'object_ids\': object_ids})\n
if \'edit_action\' in [x.get(\'id\', \'\') for x in\n try:\n
portal.portal_workflow.getActionsFor(context)]:\n
# record object deletion in workflow history\n # record object deletion in workflow history\n
portal.portal_workflow.doActionFor(context, \'edit_action\',\n portal.portal_workflow.doActionFor(context, \'edit_action\',\n
comment=comment)\n comment=comment)\n
except WorkflowException:\n
# no \'edit_action\' transition for this container\n
pass\n
\n \n
message = Base_translateString("Deleted.")\n message = Base_translateString("Deleted.")\n
\n \n
...@@ -238,6 +242,8 @@ return REQUEST.RESPONSE.redirect("%s%s" % (ret_url, qs))\n ...@@ -238,6 +242,8 @@ return REQUEST.RESPONSE.redirect("%s%s" % (ret_url, qs))\n
<string>md5_object_uid_list</string> <string>md5_object_uid_list</string>
<string>ZODB.POSException</string> <string>ZODB.POSException</string>
<string>ConflictError</string> <string>ConflictError</string>
<string>Products.CMFCore.WorkflowCore</string>
<string>WorkflowException</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>portal</string> <string>portal</string>
......
1447 1451
\ 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