Commit 99322353 authored by Jérome Perrin's avatar Jérome Perrin

Call the generic script Base_checkConsistency, which deals properly with...

Call the generic script Base_checkConsistency, which deals properly with translation of ValidationFailed

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19305 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c50baab4
No related merge requests found
...@@ -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,19 +65,8 @@ ...@@ -68,19 +65,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>state_change[\'object\'].Base_checkConsistency()\n
</string> </value>
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
object = state_change[\'object\']\n
N_ = object.Base_translateString\n
\n
check_result = object.checkConsistency()\n
\n
if len(check_result) > 0:\n
raise ValidationFailed, N_(check_result[0][-1])\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -123,14 +109,8 @@ if len(check_result) > 0:\n ...@@ -123,14 +109,8 @@ if len(check_result) > 0:\n
<value> <value>
<tuple> <tuple>
<string>state_change</string> <string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>_getitem_</string>
<string>object</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>N_</string> <string>_getitem_</string>
<string>check_result</string>
<string>len</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
147 148
\ No newline at end of file \ No newline at end of file
...@@ -65,23 +65,8 @@ ...@@ -65,23 +65,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>state_change[\'object\'].Base_checkConsistency()\n
</string> </value>
"""\n
called before submit to check if it is ok\n
otherwise set a special variable and raise validation exception\n
"""\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n
object = state_change[\'object\']\n
result = object.checkConsistency()\n
if result:\n
message= \'The document is not valid:<br/>\'\n
message += \'<br/>\'.join(\'- \' + str(r.message) for r in result)\n
raise ValidationFailed(message)\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -124,15 +109,8 @@ if result:\n ...@@ -124,15 +109,8 @@ if result:\n
<value> <value>
<tuple> <tuple>
<string>state_change</string> <string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>_getitem_</string>
<string>object</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>result</string> <string>_getitem_</string>
<string>message</string>
<string>_inplacevar_</string>
<string>_getiter_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
844 845
\ 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