Commit 969260ba authored by Ivan Tyagov's avatar Ivan Tyagov

Add conversion_failed state (indicating an external OOOd failure) and needed transitions.

Fix respective scripts to change to that state rather than add another low priority activity (which is likely to fail again).
When in this state (conversion_failed) user has a chance to act accordingly in some use cases (bad file upload)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33688 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a2f5df23
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5.Document.Document import ConversionError\n <value> <string>from Products.ERP5.Document.Document import ConversionError\n
from Products.ERP5Type.Log import log\n
from ZODB.POSException import ConflictError\n from ZODB.POSException import ConflictError\n
from xmlrpclib import Fault\n from xmlrpclib import Fault\n
from socket import error as SocketError\n from socket import error as SocketError\n
...@@ -75,12 +76,11 @@ if context.getExternalProcessingState()!=\'converted\':\n ...@@ -75,12 +76,11 @@ if context.getExternalProcessingState()!=\'converted\':\n
message = \'Problem: %s\' % (repr(e) or \'undefined.\')\n message = \'Problem: %s\' % (repr(e) or \'undefined.\')\n
except:\n except:\n
message = \'Problem: unknown\'\n message = \'Problem: unknown\'\n
\n # reach here, then exception was raised, message must be logged in workflow\n
# reach here, then exception was raised.\n # do not simply raise but rather change external processing state\n
# message must be logged in workflow.\n # so user will see something is wrong \n
context.processFile(comment=message)\n context.conversionFailed(comment=message)\n
# try again.\n log(\'%s %s\' %(context.getRelativeUrl(), message))\n
context.activate(priority=3).convertToBaseFormat()\n
return message\n return message\n
</string> </value> </string> </value>
</item> </item>
...@@ -128,6 +128,8 @@ return message\n ...@@ -128,6 +128,8 @@ return message\n
<tuple> <tuple>
<string>Products.ERP5.Document.Document</string> <string>Products.ERP5.Document.Document</string>
<string>ConversionError</string> <string>ConversionError</string>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>ZODB.POSException</string> <string>ZODB.POSException</string>
<string>ConflictError</string> <string>ConflictError</string>
<string>xmlrpclib</string> <string>xmlrpclib</string>
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from ZODB.POSException import ConflictError\n <value> <string>from ZODB.POSException import ConflictError\n
from Products.ERP5.Document.Document import ConversionError\n from Products.ERP5.Document.Document import ConversionError\n
from Products.ERP5Type.Log import log\n
\n \n
message = None\n message = None\n
try:\n try:\n
...@@ -67,11 +68,19 @@ except Exception, e:\n ...@@ -67,11 +68,19 @@ except Exception, e:\n
message = \'Problem: %s\' % (repr(e) or \'undefined.\')\n message = \'Problem: %s\' % (repr(e) or \'undefined.\')\n
except:\n except:\n
message = \'Problem: unknown\'\n message = \'Problem: unknown\'\n
# reach here, then exception was raised.\n \n
# message must be logged in workflow.\n # reach here, then exception was raised, message must be logged in workflow\n
context.updateFileMetadata(comment=message)\n # do not simply raise but rather change external processing state\n
# try again\n # so user will see something is wrong. As usually updateBaseMetadata is called\n
context.activate(priority=3).updateBaseMetadata(**kw)\n # after convertToBaseFormat it\'s possible that object is in conversion failed state \n
isTransitionPossible = context.getPortalObject().portal_workflow.isTransitionPossible\n
if isTransitionPossible(context, \'conversion_failed\'):\n
# mark document as conversion failed if not already done by convertToBaseFormat\n
context.conversionFailed(comment=message)\n
else:\n
# just save problem message in workflow history\n
context.processConversionFailed(comment=message)\n
log(\'%s %s\' %(context.getRelativeUrl(), message))\n
return message\n return message\n
</string> </value> </string> </value>
</item> </item>
...@@ -114,6 +123,8 @@ return message\n ...@@ -114,6 +123,8 @@ return message\n
<string>ConflictError</string> <string>ConflictError</string>
<string>Products.ERP5.Document.Document</string> <string>Products.ERP5.Document.Document</string>
<string>ConversionError</string> <string>ConversionError</string>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>None</string> <string>None</string>
<string>message</string> <string>message</string>
<string>_apply_</string> <string>_apply_</string>
...@@ -123,6 +134,7 @@ return message\n ...@@ -123,6 +134,7 @@ return message\n
<string>str</string> <string>str</string>
<string>Exception</string> <string>Exception</string>
<string>repr</string> <string>repr</string>
<string>isTransitionPossible</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="StateDefinition" module="Products.DCWorkflow.States"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string>Conversion process failed from some reason</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>conversion_failed</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Conversion Failed</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>convert_action</string>
<string>process_conversion_failed</string>
<string>process_file</string>
</tuple>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>conversion_failed</string>
<string>convert_action</string> <string>convert_action</string>
<string>convert_file</string> <string>convert_file</string>
<string>process_file</string> <string>process_file</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>conversion_failed</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>conversion_failed</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>process_conversion_failed</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2010-03-12 ivan
* Add conversion_failed state (indicating an external OOOd failure) and needed transitions.
2010-02-12 ivan 2010-02-12 ivan
* Add new interaction that will add contributor (logged in user) to edited document * Add new interaction that will add contributor (logged in user) to edited document
......
1092 1093
\ 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