Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions flask_principal.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,14 @@ def reverse(self):
Returns reverse of current state (needs->excludes, excludes->needs)
"""

p = Permission()
p.needs.update(self.excludes)
p.excludes.update(self.needs)
return p
tmp, needs, excludes = set(), self.needs, self.excludes
while needs:
tmp.add(needs.pop())
while excludes:
needs.add(excludes.pop())
while tmp:
excludes.add(tmp.pop())
return self

def union(self, other):
"""Create a new permission with the requirements of the union of this
Expand Down