Skip to content

Commit

Permalink
Merge pull request #59 from zopefoundation/fix_impl_python
Browse files Browse the repository at this point in the history
fix and simplify sorting of roles and permission in py3
  • Loading branch information
tseaver committed Mar 26, 2018
2 parents ee1ba80 + b990b34 commit 9ce065a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
7 changes: 1 addition & 6 deletions src/AccessControl/ImplPython.py
Expand Up @@ -781,12 +781,7 @@ def item_repr(ob):

def simplifyRoles(roles):
"""Sorts and removes duplicates from a role list."""
d = {}
for r in roles:
d[r] = 1
lst = d.keys()
lst.sort()
return lst
return sorted(set(roles))


def raiseVerbose(msg, accessed, container, name, value, context,
Expand Down
3 changes: 1 addition & 2 deletions src/AccessControl/SecurityInfo.py
Expand Up @@ -215,8 +215,7 @@ def apply(self, classobj):
# it on the class object.
getRoles = self.roles.get
__ac_permissions__ = []
permissions = list(ac_permissions.items())
permissions.sort()
permissions = sorted(ac_permissions.items())
for permission_name, names in permissions:
roles = getRoles(permission_name, ())
if len(roles):
Expand Down
9 changes: 1 addition & 8 deletions src/AccessControl/users.py
Expand Up @@ -410,14 +410,7 @@ def readUserAccessFile(filename):


def rolejoin(roles, other):
dict = {}
for role in roles:
dict[role] = 1
for role in other:
dict[role] = 1
roles = dict.keys()
roles.sort()
return roles
return sorted(set(roles).union(other))


addr_match = re.compile(r'((\d{1,3}\.){1,3}\*)|((\d{1,3}\.){3}\d{1,3})').match
Expand Down

0 comments on commit 9ce065a

Please sign in to comment.