Commit 8b8e0e2b authored by Jérome Perrin's avatar Jérome Perrin

core: drop Base_uniqueReferenceInFolderValidator

We use AttributeUnicityConstraint for this kind of checks nowadays.

Also the way "context document" was accessed does not work in RenderJS
UI
parent 90a4fa38
"""Check the object have an unique reference in it's parent folder
"""
from Products.ERP5Type.Log import log
if editor is None :
return 1
reference = editor
document = context.restrictedTraverse(request.object_path, None)
if document is None :
log('Base_uniqueReferenceInFolderValidator', 'document is None')
return 0
parent_folder = document.getParentValue()
for same_reference in parent_folder.searchFolder(reference = reference):
if same_reference.uid != document.getUid() :
log('Base_uniqueReferenceInFolderValidator',
'another document with reference %s exists at %s' % (reference, same_reference.getPath()))
return 0
return 1
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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>_params</string> </key>
<value> <string>editor, request</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_uniqueReferenceInFolderValidator</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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