[Zope-Checkins] CVS: Zope/lib/python/OFS - Cache.py:1.7 CopySupport.py:1.75 Folder.py:1.96 Traversable.py:1.12

Shane Hathaway shane@digicool.com
Fri, 19 Oct 2001 11:12:58 -0400


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv23442/lib/python/OFS

Modified Files:
	Cache.py CopySupport.py Folder.py Traversable.py 
Log Message:
- Merged cAccessControl-review-branch.

- Made some corrections to the DTML tests, which aren't currently working
in testrunner but work when run directly. ??  


=== Zope/lib/python/OFS/Cache.py 1.6 => 1.7 ===
 from AccessControl import getSecurityManager
 from AccessControl.Role import _isBeingUsedAsAMethod
+from AccessControl import Unauthorized
 
 ZCM_MANAGERS = '__ZCacheManager_ids__'
 
@@ -585,7 +586,7 @@
                 path = key[10:]
                 ob = parent.restrictedTraverse(path)
                 if not sm.checkPermission('Change cache settings', ob):
-                    raise 'Unauthorized'
+                    raise Unauthorized
                 if not isCacheable(ob):
                     # Not a cacheable object.
                     continue


=== Zope/lib/python/OFS/CopySupport.py 1.74 => 1.75 ===
                 if getSecurityManager().validate(None, parent, None, object):
                     return
-                raise 'Unauthorized', absattr(object.id)
+                raise Unauthorized, absattr(object.id)
             else:
-                raise 'Unauthorized', mt_permission
+                raise Unauthorized(permission=mt_permission)
         #
         #   XXX:    Ancient cruft, left here in true co-dependent fashion
         #           to keep from breaking old products which don't put
@@ -434,9 +434,9 @@
                 except: parent=None
                 if getSecurityManager().validate(None, parent, None, object):
                     return
-                raise 'Unauthorized', absattr(object.id)
+                raise Unauthorized, absattr(object.id)
             else:
-                raise 'Unauthorized', method_name
+                raise Unauthorized, method_name
 
         raise CopyError, MessageDialog(
               title='Not Supported',


=== Zope/lib/python/OFS/Folder.py 1.95 => 1.96 ===
 import AccessControl.Role, webdav.Collection, FindSupport
 from webdav.WriteLockInterface import WriteLockInterface
+from AccessControl import Unauthorized
 
 from Globals import DTMLFile
 from AccessControl import getSecurityManager
@@ -121,14 +122,14 @@
 
     if createUserF:
         if not checkPermission('Add User Folders', ob):
-            raise 'Unauthorized', (
+            raise Unauthorized, (
                   'You are not authorized to add User Folders.'
                   )
         ob.manage_addUserFolder()
 
     if createPublic:
         if not checkPermission('Add Page Templates', ob):
-            raise 'Unauthorized', (
+            raise Unauthorized, (
                   'You are not authorized to add Page Templates.'
                   )
         ob.manage_addProduct['PageTemplates'].manage_addPageTemplate(


=== Zope/lib/python/OFS/Traversable.py 1.11 => 1.12 ===
 from Acquisition import Acquired, aq_inner, aq_parent, aq_base
 from AccessControl import getSecurityManager
+from AccessControl import Unauthorized
 from string import split, join
 from urllib import quote
 
@@ -165,7 +166,7 @@
             pop()
             self=self.getPhysicalRoot()
             if (restricted and not securityManager.validateValue(self)):
-                raise 'Unauthorized', name
+                raise Unauthorized, name
                     
         try:
             object = self
@@ -181,7 +182,7 @@
                     if o is not M:
                         if (restricted and not securityManager.validate(
                             object, object,name, o)):
-                            raise 'Unauthorized', name
+                            raise Unauthorized, name
                         object=o
                         continue
 
@@ -198,7 +199,7 @@
                             container = object
                         if (not securityManager.validate(object,
                                                          container, name, o)):
-                            raise 'Unauthorized', name
+                            raise Unauthorized, name
                       
                 else:
                     o=get(object, name, M)
@@ -209,17 +210,17 @@
                                 # value wasn't acquired
                                 if not securityManager.validate(
                                     object, object, name, o):
-                                    raise 'Unauthorized', name
+                                    raise Unauthorized, name
                             else:
                                 if not securityManager.validate(
                                     object, N, name, o):
-                                    raise 'Unauthorized', name
+                                    raise Unauthorized, name
                         
                     else:
                         o=object[name]
                         if (restricted and not securityManager.validate(
                             object, object, N, o)):
-                            raise 'Unauthorized', name
+                            raise Unauthorized, name
 
                 object=o