Commit ee151ecb authored by Jim Fulton's avatar Jim Fulton

Added code to handle acquired methods.

parent a745b13f
...@@ -14,14 +14,17 @@ ...@@ -14,14 +14,17 @@
$Id$""" $Id$"""
from types import MethodType
# AccessControl.Implementation inserts ZopeSecurityPolicy, getRoles # AccessControl.Implementation inserts:
# ZopeSecurityPolicy, getRoles, rolesForPermissionOn
from AccessControl.SimpleObjectPolicies import _noroles from AccessControl.SimpleObjectPolicies import _noroles
rolesForPermissionOn = None # XXX: avoid import loop rolesForPermissionOn = None # XXX: avoid import loop
tuple_or_list = tuple, list tuple_or_list = tuple, list
def getRoles(container, name, value, default): def getRoles(container, name, value, default):
global rolesForPermissionOn # XXX: avoid import loop global rolesForPermissionOn # XXX: avoid import loop
...@@ -34,6 +37,9 @@ def getRoles(container, name, value, default): ...@@ -34,6 +37,9 @@ def getRoles(container, name, value, default):
if not name or not isinstance(name, basestring): if not name or not isinstance(name, basestring):
return default return default
if type(value) is MethodType:
container = value.im_self
cls = getattr(container, '__class__', None) cls = getattr(container, '__class__', None)
if cls is None: if cls is None:
return default return default
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment