Skip to content

Commit

Permalink
Revert "Fixed undesired caching in is_group_member factory"
Browse files Browse the repository at this point in the history
This reverts commit 240b0d7.
  • Loading branch information
dfunckt committed May 13, 2017
1 parent 825de4a commit 9df4825
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rules/predicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ def is_group_member(*groups):
def fn(user):
if not hasattr(user, 'groups'):
return False # swapped user model, doesn't support groups
group_names = set(user.groups.values_list('name', flat=True))
user._group_names_cache = group_names # just in case people were using this
return set(groups).issubset(group_names)
if not hasattr(user, '_group_names_cache'): # pragma: no cover
user._group_names_cache = set(user.groups.values_list('name', flat=True))
return set(groups).issubset(user._group_names_cache)

return fn

2 comments on commit 9df4825

@beruic
Copy link

@beruic beruic commented on 9df4825 Sep 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It there a bug that caused this to be reverted?

@rpkilby
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #50

Please sign in to comment.