[Checkins] SVN: zam.api/trunk/s Use removeSecurityProxy before we access site managers __bases__ because it's private and not declared in any interface which means it's protected for others then zope.Manager users

Roger Ineichen roger at projekt01.ch
Thu Mar 20 22:25:28 EDT 2008


Log message for revision 84810:
  Use removeSecurityProxy before we access site managers __bases__ because it's private and not declared in any interface which means it's protected for others then zope.Manager users

Changed:
  U   zam.api/trunk/setup.py
  U   zam.api/trunk/src/zam/api/plugin.py

-=-
Modified: zam.api/trunk/setup.py
===================================================================
--- zam.api/trunk/setup.py	2008-03-20 23:59:06 UTC (rev 84809)
+++ zam.api/trunk/setup.py	2008-03-21 02:25:27 UTC (rev 84810)
@@ -67,6 +67,7 @@
         'z3c.layer.ready2go',
         'z3c.menu.ready2go',
         'zc.configuration',
+        'zope.security',
         'zope.app.intid',
         ],
     zip_safe = False,

Modified: zam.api/trunk/src/zam/api/plugin.py
===================================================================
--- zam.api/trunk/src/zam/api/plugin.py	2008-03-20 23:59:06 UTC (rev 84809)
+++ zam.api/trunk/src/zam/api/plugin.py	2008-03-21 02:25:27 UTC (rev 84810)
@@ -18,6 +18,7 @@
 
 import zope.component
 import zope.interface
+from zope.security.proxy import removeSecurityProxy
 from zope.schema.fieldproperty import FieldProperty
 
 from zam.api import interfaces
@@ -57,6 +58,9 @@
         if not zope.component.interfaces.IComponents.providedBy(sm):
             raise ValueError('Site does not provide ``IComponents``.',
                 sm)
+        # __bases__ is a private attribute and not declared in any interface
+        # of ILocalSiteManager
+        sm = removeSecurityProxy(sm)
         return self.registry in sm.__bases__
 
     def install(self, site):
@@ -65,6 +69,8 @@
             return
         sm = site.getSiteManager()
         # new custom registry first
+        # __bases__ is a private attribute and not declared in any interface
+        sm = removeSecurityProxy(sm)
         sm.__bases__ = tuple([self.registry] + list(sm.__bases__))
 
     def uninstall(self, site):
@@ -72,6 +78,8 @@
         if not self.isInstalled(site):
             return
         sm = site.getSiteManager()
+        # __bases__ is a private attribute and not declared in any interface
+        sm = removeSecurityProxy(sm)
         bases = list(sm.__bases__)
         bases.remove(self.registry)
         sm.__bases__ = bases



More information about the Checkins mailing list