Commit c4644181 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

we can just ignore portal_type non-matching case, instead of raising an exception.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41719 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8e33a6e0
......@@ -574,10 +574,10 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
finishIngestion.
"""
document = self
catalog = self.getPortalObject().portal_catalog
if self.getReference():
catalog = self.getPortalObject().portal_catalog
# Find all document with same (reference, version, language)
kw = dict(portal_type=self.getPortalDocumentTypeList(),
kw = dict(portal_type=self.getPortalType(),
reference=self.getReference(),
where_expression=SQLQuery("validation_state NOT IN ('cancelled', 'deleted')"))
if self.getVersion():
......@@ -599,9 +599,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
# We found an existing document to update
if existing_document is not None:
document = existing_document
if existing_document.getPortalType() != self.getPortalType():
raise ValueError, "[DMS] Ingestion may not change the type of an existing document"
elif not _checkPermission(Permissions.ModifyPortalContent, existing_document):
if not _checkPermission(Permissions.ModifyPortalContent, existing_document):
raise Unauthorized, "[DMS] You are not allowed to update the existing document which has the same coordinates (id %s)" % existing_document.getId()
else:
update_kw = {}
......
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