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

mergeRevision: Do not trust catalog

Signed-off-by: Aurel's avatarAurélien Calonne <aurel@nexedi.com>
parent 11cfc320
...@@ -595,6 +595,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, ...@@ -595,6 +595,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
""" """
document = self document = self
if self.getReference(): if self.getReference():
invalid_validation_state_list = ('archived', 'cancelled', 'deleted')
catalog = self.getPortalObject().portal_catalog catalog = self.getPortalObject().portal_catalog
# Find all document with same (reference, version, language) # Find all document with same (reference, version, language)
kw = dict(portal_type=self.getPortalType(), kw = dict(portal_type=self.getPortalType(),
...@@ -614,7 +615,12 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, ...@@ -614,7 +615,12 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
o.getVersion() == self.getVersion() and\ o.getVersion() == self.getVersion() and\
o.getLanguage() == self.getLanguage(): o.getLanguage() == self.getLanguage():
existing_document = o.getObject() existing_document = o.getObject()
if existing_document.getValidationState() not in \
invalid_validation_state_list:
break break
else:
existing_document = None
# We found an existing document to update # We found an existing document to update
if existing_document is not None: if existing_document is not None:
document = existing_document document = existing_document
......
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