[Checkins] SVN: zope.security/trunk/ Fixed circular import beween ``zope.security.decorator`` and ``zope.security.proxy`` by moving the code leading to the ``ImportError`` from proxy to decorator

Michael Howitz mh at gocept.com
Tue May 3 02:25:14 EDT 2011


Log message for revision 121514:
  Fixed circular import beween ``zope.security.decorator`` and ``zope.security.proxy`` by moving the code leading to the ``ImportError`` from proxy to decorator
  

Changed:
  U   zope.security/trunk/CHANGES.txt
  U   zope.security/trunk/src/zope/security/decorator.py
  U   zope.security/trunk/src/zope/security/proxy.py

-=-
Modified: zope.security/trunk/CHANGES.txt
===================================================================
--- zope.security/trunk/CHANGES.txt	2011-05-02 18:05:48 UTC (rev 121513)
+++ zope.security/trunk/CHANGES.txt	2011-05-03 06:25:13 UTC (rev 121514)
@@ -5,7 +5,11 @@
 3.8.1 (unreleased)
 ------------------
 
+- Fixed circular import beween ``zope.security.decorator`` and
+  ``zope.security.proxy`` which led to an ``ImportError`` when only
+  importing ``zope.security.decorator``.
 
+
 3.8.0 (2010-12-14)
 ------------------
 
@@ -136,8 +140,8 @@
 
 - Moved the <class> directive implementation from `zope.app.component`
   to this package.
-  
 
+
 3.5.2 (2008-07-27)
 ------------------
 
@@ -149,15 +153,15 @@
 
 - Add `frozenset`, `set`, `reversed`, and `sorted` to the list of safe
   builtins.
-  
 
+
 3.5.0 (2008-03-05)
 ------------------
 
 - Changed title for ``zope.security.management.system_user`` to be more
   presentable.
-  
 
+
 3.4.3 - (2009/11/26)
 --------------------
 
@@ -169,8 +173,8 @@
   state of other objects. This may cause another round of garbage collection,
   eventually generating a segfault (see LP bug). The Py_VISIT macro does the
   necessary checks, so it is used instead of the previous code.
-  
 
+
 3.4.2 - (2009/03/23)
 --------------------
 
@@ -182,8 +186,8 @@
   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/trunk/src/zope/security/decorator.py
===================================================================
--- zope.security/trunk/src/zope/security/decorator.py	2011-05-02 18:05:48 UTC (rev 121513)
+++ zope.security/trunk/src/zope/security/decorator.py	2011-05-03 06:25:13 UTC (rev 121514)
@@ -206,3 +206,13 @@
 class DecoratorBase(SpecificationDecoratorBase, SecurityCheckerDecoratorBase):
     """Base class for a proxy that provides both additional interfaces and
     security declarations."""
+
+
+# zope.location was made independent of security. To work together with
+# security, we re-inject the DecoratedSecurityCheckerDescriptor onto the
+# location proxy from here.
+# This is the only sane place we found for doing it: it kicks in as soon
+# as someone starts using security proxies.
+import zope.location.location
+zope.location.location.LocationProxy.__Security_checker__ = (
+    DecoratedSecurityCheckerDescriptor())

Modified: zope.security/trunk/src/zope/security/proxy.py
===================================================================
--- zope.security/trunk/src/zope/security/proxy.py	2011-05-02 18:05:48 UTC (rev 121513)
+++ zope.security/trunk/src/zope/security/proxy.py	2011-05-03 06:25:13 UTC (rev 121514)
@@ -69,14 +69,3 @@
     # being used for isinstance
 
     return builtin_isinstance(removeSecurityProxy(object), cls)
-
-
-# zope.location was made independent of security. To work together with
-# security, we re-inject the DecoratedSecurityCheckerDescriptor onto the
-# location proxy from here.
-# This is the only sane place we found for doing it: it kicks in as soon
-# as someone starts using security proxies.
-import zope.location.location
-from zope.security.decorator import DecoratedSecurityCheckerDescriptor
-zope.location.location.LocationProxy.__Security_checker__ = (
-    DecoratedSecurityCheckerDescriptor())



More information about the checkins mailing list