Commit fc6e9b7c authored by Bartek Górny's avatar Bartek Górny

after conversion - conditional validation in try/except block

re-raise exception if something goes wrong to prevent repeated activities

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11674 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 82ae3884
...@@ -68,7 +68,9 @@ ...@@ -68,7 +68,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>ob=context\n <value> <string>from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n
ob=context\n
context.log(kw)\n context.log(kw)\n
if (ob.hasFile() and not ob.hasOOFile()) or context.REQUEST.get(\'force\'): #doublecheck\n if (ob.hasFile() and not ob.hasOOFile()) or context.REQUEST.get(\'force\'): #doublecheck\n
context.log(\'we go ahead\')\n context.log(\'we go ahead\')\n
...@@ -76,11 +78,15 @@ if (ob.hasFile() and not ob.hasOOFile()) or context.REQUEST.get(\'force\'): #dou ...@@ -76,11 +78,15 @@ if (ob.hasFile() and not ob.hasOOFile()) or context.REQUEST.get(\'force\'): #dou
res=ob.convert(force=1)\n res=ob.convert(force=1)\n
ob.setPropertyListFromContent()\n ob.setPropertyListFromContent()\n
ob.setExternalProcessingStatusMessage(\'converted\')\n ob.setExternalProcessingStatusMessage(\'converted\')\n
if context.getValidationState()!=\'validated\':\n
context.portal_workflow.doActionFor(context,\'validate_action\')\n context.portal_workflow.doActionFor(context,\'validate_action\')\n
except ValidationFailed,e:\n
ob.log(\'Exception\',e)\n
ob.setExternalProcessingStatusMessage(str(e))\n
except Exception,e:\n except Exception,e:\n
ob.log(\'Exception\',e)\n ob.log(\'Exception\',e)\n
ob.setExternalProcessingStatusMessage(str(e))\n ob.setExternalProcessingStatusMessage(str(e))\n
#raise Exception(str(e)) # do we want the activity to keep trying?\n raise Exception(str(e)) # do we want the activity to keep trying? - no, we don\'t, this will cause endless loop\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -131,13 +137,15 @@ if (ob.hasFile() and not ob.hasOOFile()) or context.REQUEST.get(\'force\'): #dou ...@@ -131,13 +137,15 @@ if (ob.hasFile() and not ob.hasOOFile()) or context.REQUEST.get(\'force\'): #dou
<tuple> <tuple>
<string>a</string> <string>a</string>
<string>kw</string> <string>kw</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>context</string> <string>context</string>
<string>ob</string> <string>ob</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>res</string> <string>res</string>
<string>Exception</string>
<string>e</string> <string>e</string>
<string>str</string> <string>str</string>
<string>Exception</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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