[Erp5-report] r41719 kazuhiko - /erp5/trunk/products/ERP5/Document/Document.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 23 17:15:02 CET 2010


Author: kazuhiko
Date: Thu Dec 23 17:15:02 2010
New Revision: 41719

URL: http://svn.erp5.org?rev=41719&view=rev
Log:
we can just ignore portal_type non-matching case, instead of raising an exception.

Modified:
    erp5/trunk/products/ERP5/Document/Document.py

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=41719&r1=41718&r2=41719&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Thu Dec 23 17:15:02 2010
@@ -574,10 +574,10 @@ class Document(DocumentExtensibleTravers
       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(DocumentExtensibleTravers
       # 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 = {}



More information about the Erp5-report mailing list