[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ PortalFolder: Modified allowedContentTypes method to check

Vincent Fretin vincent.fretin at gmail.com
Sun Jun 28 03:44:50 EDT 2009


Log message for revision 101298:
  PortalFolder: Modified allowedContentTypes method to check
  isConstructionAllowed only for allowed types, not for all content types.
  

Changed:
  U   Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
  U   Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt	2009-06-27 23:14:51 UTC (rev 101297)
+++ Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt	2009-06-28 07:44:50 UTC (rev 101298)
@@ -4,6 +4,9 @@
 2.2.0 (unreleased)
 ------------------
 
+- PortalFolder: Modified allowedContentTypes method to check 
+  isConstructionAllowed only for allowed types, not for all content types.
+
 - Fixed typo in the acquisition wrapping of the found utility in
   getToolByName.
 

Modified: Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py	2009-06-27 23:14:51 UTC (rev 101297)
+++ Products.CMFCore/trunk/Products/CMFCore/PortalFolder.py	2009-06-28 07:44:50 UTC (rev 101298)
@@ -125,20 +125,14 @@
             List type info objects for types which can be added in
             this folder.
         """
-        result = []
         portal_types = getToolByName(self, 'portal_types')
         myType = portal_types.getTypeInfo(self)
+        result = portal_types.listTypeInfo()
 
         if myType is not None:
-            for contentType in portal_types.listTypeInfo(self):
-                if myType.allowType( contentType.getId() ):
-                    result.append( contentType )
-        else:
-            result = portal_types.listTypeInfo()
+            return [t for t in result if myType.allowType(t.getId()) and t.isConstructionAllowed(self)]
 
-        return filter( lambda typ, container=self:
-                          typ.isConstructionAllowed( container )
-                     , result )
+        return [t for t in result if t.isConstructionAllowed(self)]
 
     def _filteredItems( self, ids, filt ):
         """



More information about the Checkins mailing list