[CMF-checkins] CVS: Products/CMFCore - TypesTool.py:1.74.2.4

Tres Seaver tseaver at zope.com
Sat Sep 25 16:30:29 EDT 2004


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv6340/CMFCore

Modified Files:
      Tag: CMF-1_5-branch
	TypesTool.py 
Log Message:
 - Harden '_queryFactoryMethod' against unwrapped objects.


=== Products/CMFCore/TypesTool.py 1.74.2.3 => 1.74.2.4 ===
--- Products/CMFCore/TypesTool.py:1.74.2.3	Tue Sep  7 04:47:53 2004
+++ Products/CMFCore/TypesTool.py	Sat Sep 25 16:30:28 2004
@@ -514,10 +514,17 @@
         raise AccessControl_Unauthorized( 'Cannot create %s' % self.getId() )
 
     def _queryFactoryMethod(self, container, default=None):
-        if not self.product or not self.factory:
+
+        if not self.product or not self.factory or container is None:
             return default
+
+        dispatcher = getattr(container, 'manage_addProduct', None)
+
+        if dispatcher is None:
+            return default
+
         try:
-            p = container.manage_addProduct[self.product]
+            p = dispatcher[self.product]
         except AttributeError:
             LOG('Types Tool', ERROR, '_queryFactoryMethod raised an exception',
                 error=exc_info())



More information about the CMF-checkins mailing list