Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : bkabrda-workspace
commit bdea269979e248f0cd3b7a1bb9128740e7a2688b Author: Bohuslav Kabrda bkabrda@redhat.com Date: Mon Nov 26 13:05:50 2012 +0100
Make the enum fail fast instead of returning None
wsgi/coprs/helpers.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/wsgi/coprs/helpers.py b/wsgi/coprs/helpers.py index 6eae1e2..c2bf632 100644 --- a/wsgi/coprs/helpers.py +++ b/wsgi/coprs/helpers.py @@ -13,14 +13,14 @@ class PermissionEnum(object):
@classmethod def num(cls, key): - return cls.vals.get(key, None) + return cls.vals[key]
@classmethod def key(cls, num): for k, n in cls.vals.items(): if n == num: return k - return None + raise KeyError('num {0} is not mapped'.format(num))
@classmethod def choices_list(cls, without = 2):
copr-devel@lists.fedorahosted.org