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

object -> document


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34835 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8140769c
...@@ -54,7 +54,7 @@ class DocumentReferenceConstraint(Constraint): ...@@ -54,7 +54,7 @@ class DocumentReferenceConstraint(Constraint):
'Multiple (${document_count}) documents ${document_reference} - ' 'Multiple (${document_count}) documents ${document_reference} - '
'${document_language} - ${document_version} already exists') '${document_language} - ${document_version} already exists')
def checkConsistency(self, object, fixit=0): def checkConsistency(self, document, fixit=0):
""" """
Implement here the consistency checker Implement here the consistency checker
""" """
...@@ -63,8 +63,8 @@ class DocumentReferenceConstraint(Constraint): ...@@ -63,8 +63,8 @@ class DocumentReferenceConstraint(Constraint):
error_list = [] error_list = []
for property_id in ('reference', 'language', 'version'): for property_id in ('reference', 'language', 'version'):
if object.getProperty(property_id) in (None, ''): if document.getProperty(property_id) in (None, ''):
error_list.append(self._generateError(object, error_list.append(self._generateError(document,
self._getMessage('message_property_not_defined'), self._getMessage('message_property_not_defined'),
mapping=dict(property_id=property_id))) mapping=dict(property_id=property_id)))
if error_list: if error_list:
...@@ -72,26 +72,26 @@ class DocumentReferenceConstraint(Constraint): ...@@ -72,26 +72,26 @@ class DocumentReferenceConstraint(Constraint):
# XXX isn't it better to use unrestrictedSearchResults ? # XXX isn't it better to use unrestrictedSearchResults ?
# potential problem is that we would get deleted documents aswell # potential problem is that we would get deleted documents aswell
res = object.portal_catalog(reference=object.getReference(), res = document.portal_catalog(reference=document.getReference(),
language=object.getLanguage(), language=document.getLanguage(),
version=object.getVersion(), version=document.getVersion(),
portal_type=object.getPortalDocumentTypeList()) portal_type=document.getPortalDocumentTypeList())
res = list(res) res = list(res)
if len(res) == 2: # this object and another object if len(res) == 2: # this document and another document
error_list.append(self._generateError(object, error_list.append(self._generateError(document,
self._getMessage('message_another_document_exists'), self._getMessage('message_another_document_exists'),
mapping=dict(document_reference=object.getReference(), mapping=dict(document_reference=document.getReference(),
document_language=object.getLanguage(), document_language=document.getLanguage(),
document_version=object.getVersion()))) document_version=document.getVersion())))
if len(res) > 2: if len(res) > 2:
# this is very serious since there are many objects with the same # this is very serious since there are many document with the same
# reference # reference
error_list.append(self._generateError(object, error_list.append(self._generateError(document,
self._getMessage('message_multiple_documents_exists'), self._getMessage('message_multiple_documents_exists'),
mapping=dict(document_count=len(res), mapping=dict(document_count=len(res),
document_reference=object.getReference(), document_reference=document.getReference(),
document_language=object.getLanguage(), document_language=document.getLanguage(),
document_version=object.getVersion()))) document_version=document.getVersion())))
return error_list return error_list
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