Skip to content

Commit

Permalink
Check for both __self__ and im_self for Python 3 compatibility
Browse files Browse the repository at this point in the history
Co-authored-by: Wildcard Corp. <corporate@wildcardcorp.com>
  • Loading branch information
vangheem and Wildcard Corp. committed Nov 15, 2018
1 parent 1c1f69f commit fe9a7a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Products/PlonePAS/plugins/local_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def getRolesInContext(self, user, object):
object = parent
continue

new = getattr(object, 'im_self', None)
new = (getattr(object, 'im_self', None) or
getattr(object, '__self__', None))

if new is not None:
object = aq_inner(new)
Expand Down Expand Up @@ -134,7 +135,8 @@ def checkLocalRolesAllowed(self, user, object, object_roles):
inner_obj = parent
continue

new = getattr(inner_obj, 'im_self', None)
new = (getattr(inner_obj, 'im_self', None) or
getattr(inner_obj, '__self__', None))

if new is not None:
inner_obj = aq_inner(new)
Expand Down Expand Up @@ -175,7 +177,8 @@ def getAllLocalRolesInContext(self, context):
object = parent
continue

new = getattr(object, 'im_self', None)
new = (getattr(object, 'im_self', None) or
getattr(object, '__self__', None))

if new is not None:
object = aq_inner(new)
Expand Down

0 comments on commit fe9a7a1

Please sign in to comment.