[Checkins] SVN: zope.security/branches/3.4/ Backported a fix made by Albertas Agejevas to the 3.4 branch. He fixed

Ignas Mikalajënas ignas at pov.lt
Mon Mar 23 08:49:57 EDT 2009


Log message for revision 98317:
  Backported a fix made by Albertas Agejevas to the 3.4 branch. He fixed
  a bug in DecoratedSecurityCheckerDescriptor which made
  security-wrapping location proxied exception instances throw
  exceptions on Python 2.5.  See
  https://bugs.launchpad.net/zope3/+bug/251848
  

Changed:
  U   zope.security/branches/3.4/CHANGES.txt
  U   zope.security/branches/3.4/src/zope/security/decorator.py

-=-
Modified: zope.security/branches/3.4/CHANGES.txt
===================================================================
--- zope.security/branches/3.4/CHANGES.txt	2009-03-23 12:49:32 UTC (rev 98316)
+++ zope.security/branches/3.4/CHANGES.txt	2009-03-23 12:49:57 UTC (rev 98317)
@@ -2,6 +2,16 @@
 CHANGES
 =======
 
+3.4.2 - (unreleased)
+-------------------------------
+
+- Backported a fix made by Albertas Agejevas to the 3.4 branch. He
+  fixed a bug in DecoratedSecurityCheckerDescriptor which made
+  security-wrapping location proxied exception instances throw
+  exceptions on Python 2.5.  See
+  https://bugs.launchpad.net/zope3/+bug/251848
+
+
 3.4.1 - 2008/07/27
 ------------------
 

Modified: zope.security/branches/3.4/src/zope/security/decorator.py
===================================================================
--- zope.security/branches/3.4/src/zope/security/decorator.py	2009-03-23 12:49:32 UTC (rev 98316)
+++ zope.security/branches/3.4/src/zope/security/decorator.py	2009-03-23 12:49:57 UTC (rev 98317)
@@ -158,7 +158,15 @@
 
     the decorator doesn't have a checker:
 
-      >>> wrapper.__Security_checker__ is None
+      >>> wrapper.__Security_checker__
+      Traceback (most recent call last):
+        ...
+      AttributeError: 'Foo' has no attribute '__Security_checker__'
+
+    __Security_checker__ cannot be None, otherwise Checker.proxy blows
+    up:
+
+      >>> checker.proxy(wrapper) is wrapper
       True
 
     """
@@ -174,7 +182,11 @@
                 if checker is None:
                     checker = selectChecker(proxied_object)
             wrapper_checker = selectChecker(inst)
-            if wrapper_checker is None:
+            if wrapper_checker is None and checker is None:
+                raise AttributeError("%r has no attribute %r" %
+                                     (proxied_object.__class__.__name__,
+                                      '__Security_checker__'))
+            elif wrapper_checker is None:
                 return checker
             elif checker is None:
                 return wrapper_checker



More information about the Checkins mailing list