Commit 42cb466a authored by Bartek Górny's avatar Bartek Górny

Verify uniqueness of doc identifier upon submission

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9934 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 10f91a59
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n
err=\'\'\n
o=state_change.object\n
for req in (\'reference\', \'language\', \'version\'):\n
if o.getProperty(req) is None or o.getProperty(req)==\'\':\n
err+=\'E: %s is None \' % req\n
if err:\n
raise ValidationFailed(err)\n
res=context.portal_catalog(reference=o.getReference())\n
res=[r.getObject() for r in res]\n
res=filter(lambda r:r.getLanguage()==o.getLanguage() and r.getVersion()==o.getVersion(),res)\n
if len(res)==2: # this and the other one\n
raise ValidationFailed(\'E: another object %s - %s - %s exists\' % (o.getReference(),o.getLanguage(),o.getVersion()))\n
if len(res)>2:\n
raise Exception(\'Fatal error: multiple objects %s - %s - %s exist\' % (o.getReference(),o.getLanguage(),o.getVersion()))\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>err</string>
<string>_getattr_</string>
<string>o</string>
<string>_getiter_</string>
<string>req</string>
<string>None</string>
<string>context</string>
<string>res</string>
<string>append</string>
<string>$append0</string>
<string>r</string>
<string>filter</string>
<string>len</string>
<string>Exception</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>checkUniqueCoordinates</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
<value> <string>checkUniqueCoordinates</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
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