[Erp5-report] r32728 nicolas.dumazet - /erp5/trunk/products/ERP5Type/XMLMatrix.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 18 09:29:01 CET 2010


Author: nicolas.dumazet
Date: Thu Feb 18 09:28:58 2010
New Revision: 32728

URL: http://svn.erp5.org?rev=32728&view=rev
Log:
do not compute the whole portal type list to only take the first item

Modified:
    erp5/trunk/products/ERP5Type/XMLMatrix.py

Modified: erp5/trunk/products/ERP5Type/XMLMatrix.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/XMLMatrix.py?rev=32728&r1=32727&r2=32728&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/XMLMatrix.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/XMLMatrix.py [utf8] Thu Feb 18 09:28:58 2010
@@ -516,11 +516,12 @@
         meant to be overriden by subclasses.
       """
       if portal_type is None:
-        try:
-          portal_type = [x.getId() for x in self.allowedContentTypes() \
-                         if x.getId().endswith(' Cell')][0]
-        except IndexError:
-          pass
+        for x in self.allowedContentTypes():
+          id = x.getId()
+          if id.endswith(' Cell'):
+            portal_type = id
+            break
+
       return self.newContent(id=id, portal_type=portal_type, **kw)
 
     security.declareProtected( Permissions.AccessContentsInformation,




More information about the Erp5-report mailing list