Use the canonical forms of getting an object's innermost wrapper and an object's

parent (by using the aq_inner() and aq_parent() functions, not the attributes).
parent 80421185
...@@ -17,11 +17,8 @@ import os ...@@ -17,11 +17,8 @@ import os
import string import string
from logging import getLogger from logging import getLogger
from Acquisition import aq_base from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
from Acquisition import aq_parent
from Acquisition import aq_inner
from Acquisition import aq_inContextOf from Acquisition import aq_inContextOf
from Acquisition import aq_acquire
from ExtensionClass import Base from ExtensionClass import Base
from zope.interface import implements from zope.interface import implements
...@@ -99,10 +96,10 @@ def rolesForPermissionOn(perm, object, default=_default_roles, n=None): ...@@ -99,10 +96,10 @@ def rolesForPermissionOn(perm, object, default=_default_roles, n=None):
else: else:
r = r + list(roles) r = r + list(roles)
object = getattr(object, 'aq_inner', None) object = aq_inner(object)
if object is None: if object is None:
break break
object = object.__parent__ object = aq_parent(object)
if r is None: if r is None:
if _embed_permission_in_roles: if _embed_permission_in_roles:
......
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