Commit 3d719bd3 authored by Jérome Perrin's avatar Jérome Perrin

get the currenct object by its path, not uid, because the uid is not always set.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5386 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1c7a75da
...@@ -74,15 +74,16 @@ if editor is None : \n ...@@ -74,15 +74,16 @@ if editor is None : \n
\n \n
reference = editor\n reference = editor\n
\n \n
document = context.portal_catalog.getObject(request.object_uid)\n document = context.restrictedTraverse(request.object_path, None)\n
if document is None : \n if document is None : \n
#context.log(\'document is None\',\'\') # log may not work with unprivilegied user\n context.log(\'Base_uniqueReferenceInFolderValidator\', \'document is None\')\n
return 0\n return 0\n
\n \n
parent_folder = document.getParentValue()\n parent_folder = document.getParentValue()\n
for same_reference in parent_folder.searchFolder(reference = reference):\n for same_reference in parent_folder.searchFolder(reference = reference):\n
if same_reference.uid != document.getUid() :\n if same_reference.uid != document.getUid() :\n
#context.log(\'another document with reference %s exists at\' % reference, same_reference.getPath())\n context.log(\'Base_uniqueReferenceInFolderValidator\',\n
\'another document with reference %s exists at %s\' % (reference, same_reference.getPath()))\n
return 0\n return 0\n
\n \n
return 1\n return 1\n
......
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