diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-11 17:45:05 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-11 17:45:05 +0000 |
commit | f5458611072ab7c6048311430771d1ec297d4f61 (patch) | |
tree | 0f3c8787b0063a6d78a347e6b3f5276f3a5f4513 /libbe/bugdir.py | |
parent | 56c2c54ef00acc75f2bce8ded2b7fa66e8d07712 (diff) | |
download | bugseverywhere-f5458611072ab7c6048311430771d1ec297d4f61.tar.gz |
Added severity command
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r-- | libbe/bugdir.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 0008be8..4a79584 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -5,7 +5,7 @@ import errno import names import rcs -class NoBugDir(cmdutil.UserError): +class NoBugDir(Exception): def __init__(self, path): msg = "The directory \"%s\" has no bug directory." % path Exception.__init__(self, msg) @@ -53,17 +53,24 @@ class BugDir: path = os.path.join(self.bugs_path, uuid) rcs.mkdir(path) return Bug(self.bugs_path, uuid) - +class InvalidValue(Exception): + def __init__(self, name, value): + msg = "Cannot assign value %s to %s" % (value, name) + Exception.__init__(self, msg) + self.name = name + self.value = value def file_property(name, valid=None): def getter(self): value = self._get_value(name) if valid is not None: - assert value in valid + if value not in valid: + raise InvalidValue(name, value) return value def setter(self, value): if valid is not None: - assert value in valid + if value not in valid: + raise InvalidValue(name, value) return self._set_value(name, value) return property(getter, setter) |