[Zope-Checkins] SVN: Zope/branches/tseaver-five-integration-security/lib/python/AccessControl/ZopeSecurityPolicy.py Added code to handle acquired methods.

Jim Fulton jim at zope.com
Mon Mar 28 15:56:54 EST 2005


Log message for revision 29709:
  Added code to handle acquired methods.
  

Changed:
  U   Zope/branches/tseaver-five-integration-security/lib/python/AccessControl/ZopeSecurityPolicy.py

-=-
Modified: Zope/branches/tseaver-five-integration-security/lib/python/AccessControl/ZopeSecurityPolicy.py
===================================================================
--- Zope/branches/tseaver-five-integration-security/lib/python/AccessControl/ZopeSecurityPolicy.py	2005-03-28 20:48:53 UTC (rev 29708)
+++ Zope/branches/tseaver-five-integration-security/lib/python/AccessControl/ZopeSecurityPolicy.py	2005-03-28 20:56:54 UTC (rev 29709)
@@ -14,14 +14,17 @@
 
 $Id$"""
 
+from types import MethodType
 
-# AccessControl.Implementation inserts ZopeSecurityPolicy, getRoles
+# AccessControl.Implementation inserts:
+#   ZopeSecurityPolicy, getRoles, rolesForPermissionOn
 from AccessControl.SimpleObjectPolicies import _noroles
 
 rolesForPermissionOn = None  # XXX:  avoid import loop
 
 tuple_or_list = tuple, list
 
+
 def getRoles(container, name, value, default):
 
     global rolesForPermissionOn  # XXX:  avoid import loop
@@ -34,6 +37,9 @@
         if not name or not isinstance(name, basestring):
             return default
 
+        if type(value) is MethodType:
+            container = value.im_self
+
         cls = getattr(container, '__class__', None)
         if cls is None:
             return default



More information about the Zope-Checkins mailing list