Change PermissionMap rule_weight to not raise exception.

We always want the rule_weight to work, even in the face of unmapped
permissions.  Other functions, e.g. for handling permission map editing
and saving may raise an exception.
This commit is contained in:
Chris PeBenito 2014-11-09 20:04:32 -05:00
parent 8a07be100f
commit 767c32b652

View File

@ -149,10 +149,7 @@ class PermissionMap(object):
for perm_name in rule.perms:
mapping = self.permmap[class_name][perm_name]
if mapping[0] == "u":
raise UnmappedPermission(
"{0}:{1} is not mapped.".format(class_name, perm_name))
elif mapping[0] == "r":
if mapping[0] == "r":
read_weight = max(read_weight, mapping[1])
elif mapping[0] == "w":
write_weight = max(write_weight, mapping[1])