Commit 61dc1dd0 authored by Ivan Tyagov's avatar Ivan Tyagov

No need to repeat same code, define it only once.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38953 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1c62d5bd
......@@ -515,20 +515,14 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixIn, CachedCo
"""
if not self.getReference():
return True
catalog = getToolByName(self.getPortalObject(), 'portal_catalog')
self_count = catalog.unrestrictedCountResults(portal_type=self.getPortalDocumentTypeList(),
reference=self.getReference(),
version=self.getVersion(),
language=self.getLanguage(),
uid=self.getUid(),
validation_state="!=cancelled"
)[0][0]
count = catalog.unrestrictedCountResults(portal_type=self.getPortalDocumentTypeList(),
kw = dict(portal_type=self.getPortalDocumentTypeList(),
reference=self.getReference(),
version=self.getVersion(),
language=self.getLanguage(),
validation_state="!=cancelled"
)[0][0]
validation_state="!=cancelled")
catalog = getToolByName(self.getPortalObject(), 'portal_catalog')
self_count = catalog.unrestrictedCountResults(uid=self.getUid(), **kw)[0][0]
count = catalog.unrestrictedCountResults(**kw)[0][0]
# If self is not indexed yet, then if count == 1, version is not unique
return count <= self_count
......
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