[CMF-checkins] CVS: Products/CMFCore - TypesTool.py:1.79
Tres Seaver
tseaver at zope.com
Sat Sep 25 16:31:22 EDT 2004
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv6626/CMFCore
Modified Files:
TypesTool.py
Log Message:
- Harden '_queryFactoryMethod' against unwrapped objects.
=== Products/CMFCore/TypesTool.py 1.78 => 1.79 ===
--- Products/CMFCore/TypesTool.py:1.78 Tue Sep 14 15:02:21 2004
+++ Products/CMFCore/TypesTool.py Sat Sep 25 16:31:22 2004
@@ -475,15 +475,25 @@
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
+
+ # In case we aren't wrapped.
+ 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())
return default
+
m = getattr(p, self.factory, None)
+
if m:
try:
# validate() can either raise Unauthorized or return 0 to
@@ -492,6 +502,7 @@
return m
except zExceptions_Unauthorized: # Catch *all* Unauths!
pass
+
return default
security.declarePublic('isConstructionAllowed')
More information about the CMF-checkins
mailing list