[Erp5-report] r32080 leonardo - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: SkinTempl...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 28 22:16:17 CET 2010


Author: leonardo
Date: Thu Jan 28 22:16:16 2010
New Revision: 32080

URL: http://svn.erp5.org?rev=32080&view=rev
Log:
Get rid of pointless "check before you leap" uses of portal_workflow.getActionsFor(), which, by the way, has disappeared from CMF 2

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_delete.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml?rev=32080&r1=32079&r2=32080&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_workflowStatusModify.xml [utf8] Thu Jan 28 22:16:16 2010
@@ -54,19 +54,18 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
+from Products.CMFCore.WorkflowCore import WorkflowException\n
 \n
 o = context.getObject()\n
 \n
-action_list = context.portal_workflow.getActionsFor(o)\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
+if 1: # keep indentation\n
   try : \n
     context.portal_workflow.doActionFor( o,\n
      workflow_action,\n
      comment=comment,\n
      **kw)\n
+  except WorkflowException:\n
+    pass\n
   except ValidationFailed, message:\n
     if getattr(message, \'msg\', None) and same_type(message.msg, []):\n
       message = \'. \'.join(\'%s\' % x for x in message.msg)\n
@@ -116,13 +115,11 @@
                             <string>kw</string>
                             <string>Products.DCWorkflow.DCWorkflow</string>
                             <string>ValidationFailed</string>
+                            <string>Products.CMFCore.WorkflowCore</string>
+                            <string>WorkflowException</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>o</string>
-                            <string>action_list</string>
-                            <string>filter</string>
-                            <string>map</string>
-                            <string>action_id_list</string>
                             <string>_apply_</string>
                             <string>message</string>
                             <string>getattr</string>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_delete.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_delete.xml?rev=32080&r1=32079&r2=32080&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_delete.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_delete.xml [utf8] Thu Jan 28 22:16:16 2010
@@ -56,6 +56,8 @@
             <value> <string encoding="cdata"><![CDATA[
 
 from ZODB.POSException import ConflictError\n
+from Products.CMFCore.WorkflowCore import WorkflowException\n
+\n
 portal = context.getPortalObject()\n
 Base_translateString = portal.Base_translateString\n
 \n
@@ -146,11 +148,13 @@
       object_ids = [x.getId() for x in object_to_remove_list]\n
       comment = Base_translateString(\'Deleted objects: ${object_ids}\',\n
                                      mapping={\'object_ids\': object_ids})\n
-      if \'edit_action\' in [x.get(\'id\', \'\') for x in\n
-                           portal.portal_workflow.getActionsFor(context)]:\n
+      try:\n
         # record object deletion in workflow history\n
         portal.portal_workflow.doActionFor(context, \'edit_action\',\n
                                            comment=comment)\n
+      except WorkflowException:\n
+        # no \'edit_action\' transition for this container\n
+        pass\n
 \n
       message = Base_translateString("Deleted.")\n
 \n
@@ -238,6 +242,8 @@
                             <string>md5_object_uid_list</string>
                             <string>ZODB.POSException</string>
                             <string>ConflictError</string>
+                            <string>Products.CMFCore.WorkflowCore</string>
+                            <string>WorkflowException</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>portal</string>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision?rev=32080&r1=32079&r2=32080&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/bt/revision [utf8] Thu Jan 28 22:16:16 2010
@@ -1,1 +1,1 @@
-1447
+1451




More information about the Erp5-report mailing list