[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/ Fix a typo. Make Unauthorized exception take a name and permission arguments on constructor, and fix two places where a message was being passed instead of a name

Sidnei da Silva sidnei at awkly.org
Fri Jul 9 14:32:59 EDT 2004


Log message for revision 26360:
Fix a typo. Make Unauthorized exception take a name and permission arguments on constructor, and fix two places where a message was being passed instead of a name


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publication/traversers.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publication/traversers.py	2004-07-09 16:26:39 UTC (rev 26359)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publication/traversers.py	2004-07-09 18:32:59 UTC (rev 26360)
@@ -89,7 +89,7 @@
             return getView(ob, name[6:], request)
 
         if name.startswith('_'):
-            raise Unauthorized("Name %s begins with an underscore" % `name`)
+            raise Unauthorized, name
 
         subob = getattr(ob, name, self) # self is marker here
         if subob is self:

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metaconfigure.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metaconfigure.py	2004-07-09 16:26:39 UTC (rev 26359)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/publisher/browser/metaconfigure.py	2004-07-09 18:32:59 UTC (rev 26360)
@@ -81,7 +81,7 @@
     """Create an add menu item for a given class or factory
 
     As a convenience, a class can be provided, in which case, a factory is
-    automatically defined baded on the class.
+    automatically defined based on the class.
     """
     if class_ is None:
         if factory is None:

Modified: Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py	2004-07-09 16:26:39 UTC (rev 26359)
+++ Zope3/branches/ZopeX3-3.0/src/zope/exceptions/unauthorized.py	2004-07-09 18:32:59 UTC (rev 26360)
@@ -26,3 +26,6 @@
     """Some user wasn't allowed to access a resource"""
 
     implements(IUnauthorized)
+
+    def __init__(self, name=None, permission=None):
+        self.name, self.permission = name, permission

Modified: Zope3/branches/ZopeX3-3.0/src/zope/publisher/base.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/publisher/base.py	2004-07-09 16:26:39 UTC (rev 26359)
+++ Zope3/branches/ZopeX3-3.0/src/zope/publisher/base.py	2004-07-09 18:32:59 UTC (rev 26360)
@@ -457,7 +457,7 @@
 
     def traverseName(self, request, ob, name, check_auth=1):
         if name.startswith('_'):
-            raise Unauthorized("Name %s begins with an underscore" % `name`)
+            raise Unauthorized, name
         if hasattr(ob, name):
             subob = getattr(ob, name)
         else:

Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py	2004-07-09 16:26:39 UTC (rev 26359)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py	2004-07-09 18:32:59 UTC (rev 26360)
@@ -127,7 +127,7 @@
             permission = self.set_permissions.get(name)
         else:
             permission = None
-            
+
         if permission is not None:
             if permission is CheckerPublic:
                 return # Public
@@ -137,7 +137,7 @@
                 return
             else:
                 __traceback_supplement__ = (TracebackSupplement, object)
-                raise Unauthorized, name
+                raise Unauthorized(name=name, permission=permission)
 
         __traceback_supplement__ = (TracebackSupplement, object)
         raise ForbiddenAttribute, (name, object)
@@ -154,7 +154,7 @@
                 return
             else:
                 __traceback_supplement__ = (TracebackSupplement, object)
-                raise Unauthorized, name
+                raise Unauthorized(name=name, permission=permission)
         elif name in _always_available:
             return
 



More information about the Zope3-Checkins mailing list