diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-05 03:32:06 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-05 03:32:06 -0500 |
commit | f7f0d9c959aee752298fdfe7a73939cf4c09fda5 (patch) | |
tree | 5f2be9fc01e67015991bcb8ce1cc89e2807c3c4b /libbe/diff.py | |
parent | 1f59c7ef9019879d0b5e407492e4a6e04c5a29cc (diff) | |
download | bugseverywhere-f7f0d9c959aee752298fdfe7a73939cf4c09fda5.tar.gz |
Adjusted diff.Subscription.__init__() to guess type_root if required.
Diffstat (limited to 'libbe/diff.py')
-rw-r--r-- | libbe/diff.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libbe/diff.py b/libbe/diff.py index b5384a8..73db13d 100644 --- a/libbe/diff.py +++ b/libbe/diff.py @@ -75,13 +75,18 @@ def type_from_name(name, type_root, default=None, default_ok=False): class Subscription (object): """ - >>> subscriptions = [Subscription('XYZ', 'all', type_root=BUG_TYPE_ALL), - ... Subscription('DIR', 'new', type_root=BUGDIR_TYPE_ALL), + >>> subscriptions = [Subscription('XYZ', 'all'), + ... Subscription('DIR', 'new'), ... Subscription('ABC', BUG_TYPE_ALL),] >>> print sorted(subscriptions) [<Subscription: DIR (new)>, <Subscription: ABC (all)>, <Subscription: XYZ (all)>] """ def __init__(self, id, subscription_type, **kwargs): + if 'type_root' not in kwargs: + if id == BUGDIR_ID: + kwargs['type_root'] = BUGDIR_TYPE_ALL + else: + kwargs['type_root'] = BUG_TYPE_ALL if type(subscription_type) in types.StringTypes: subscription_type = type_from_name(subscription_type, **kwargs) self.id = id |