[CMF-checkins] CVS: CMF/CMFCore - PortalFolder.py:1.33

Florent Guillaume fg@nuxeo.com
Fri, 28 Jun 2002 16:53:53 -0400


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv5907/CMFCore

Modified Files:
	PortalFolder.py 
Log Message:
Fix exception handling to not use a string exception in PortalFolder
(Tracker #512).


=== CMF/CMFCore/PortalFolder.py 1.32 => 1.33 ===
 from OFS.ObjectManager import REPLACEABLE
 from Globals import DTMLFile
-from AccessControl import getSecurityManager, ClassSecurityInfo
+from AccessControl import getSecurityManager, ClassSecurityInfo, Unauthorized
 from Acquisition import aq_parent, aq_inner, aq_base
 from DynamicType import DynamicType
 from utils import getToolByName, _checkPermission
@@ -217,10 +217,12 @@
         for obj in items:
             id = obj.getId()
             v = obj
-            try: 
+            # validate() can either raise Unauthorized or return 0 to
+            # mean unauthorized.
+            try:
                 if getSecurityManager().validate(self, self, id, v):
                     l.append(obj)
-            except "Unauthorized":
+            except Unauthorized:
                 pass
         return l