[Erp5-report] r15268 - /erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 20 16:29:06 CEST 2007


Author: romain
Date: Fri Jul 20 16:29:05 2007
New Revision: 15268

URL: http://svn.erp5.org?rev=15268&view=rev
Log:
Raise a more error message to help debugging.
This should not impact the performance, as this method is cached.

Modified:
    erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py

Modified: erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py?rev=15268&r1=15267&r2=15268&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py (original)
+++ erp5/trunk/products/ERP5Type/patches/CMFBTreeFolder.py Fri Jul 20 16:29:05 2007
@@ -39,21 +39,22 @@
   if myType is not None:
     allowed_types_to_check = []
     if myType.filter_content_types:
-      result = [portal_types.getTypeInfo(x) for x in 
-                   myType.allowed_content_types]
+      for portal_type in myType.allowed_content_types:
+        contentType = portal_types.getTypeInfo(portal_type)
+        if contentType is None:
+          raise AttributeError, "Portal type '%s' does not exist " \
+                                "and should not be allowed in '%s'" % \
+                                (portal_type, self.getPortalType())
+        result.append(contentType)
     else:
-      if myType is not None:
-          for contentType in portal_types.listTypeInfo(self):
-              if myType.allowType( contentType.getId() ):
-                  result.append( contentType )
+      for contentType in portal_types.listTypeInfo(self):
+        if myType.allowType(contentType.getId()):
+          result.append(contentType)
   else:
       result = portal_types.listTypeInfo()
 
-  return filter( lambda typ, container=self:
-                    typ.isConstructionAllowed( container )
-               , result )
-
-
+  return filter(
+      lambda typ, container=self: typ.isConstructionAllowed(container),
+      result)
 
 CMFBTreeFolder.allowedContentTypes = CMFBTreeFolder_allowedContentTypes
-




More information about the Erp5-report mailing list