Skip to content

Commit

Permalink
use set instead of list for performance reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshvv committed Apr 24, 2013
1 parent 3838396 commit 1401dd7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AccessControl/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def allowed(self, object, object_roles=None):
# we can incur only the overhead required to find a match.
inner_obj = getattr(object, 'aq_inner', object)
userid = self.getId()
parents = []
parents = set()
while 1:
local_roles = getattr(inner_obj, '__ac_local_roles__', None)
if local_roles:
Expand All @@ -229,7 +229,7 @@ def allowed(self, object, object_roles=None):
if parent is not None:
if parent in parents:
break
parents.append(parent)
parents.add(parent)
inner_obj = parent
continue
if hasattr(inner_obj, 'im_self'):
Expand Down

0 comments on commit 1401dd7

Please sign in to comment.