diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-05 07:41:50 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-05 07:41:50 -0500 |
commit | cc58188259e36193c3174fbb55e37c790382a7ea (patch) | |
tree | d15b1a702dc720b1a193ff43a5feecd15c08bf1e /libbe/diff.py | |
parent | 167a8d2ae883fecf4e9d375e333e406dc723ef3b (diff) | |
download | bugseverywhere-cc58188259e36193c3174fbb55e37c790382a7ea.tar.gz |
Use new libbe.diff.Diff.report_tree(subscriptions) in be-handle-mail.
This makes Message.subscriber_emails() much cleaner.
Also fix libbe.diff.Diff._sub_report() to handle missing
'bugdir/settings'.
Added libbe.diff.SubscriptionType.__cmp__ so that
SubscriptionType('all') == SubscriptionType('all')
This is important when comparing the types returned by
becommands.subscribe.get_bugdir_subscribers()
with the libbe.diff.*_TYPE_* types.
Diffstat (limited to 'libbe/diff.py')
-rw-r--r-- | libbe/diff.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libbe/diff.py b/libbe/diff.py index fb2b249..46b8bda 100644 --- a/libbe/diff.py +++ b/libbe/diff.py @@ -38,6 +38,8 @@ class SubscriptionType (tree.Tree): self.type = type_name def __str__(self): return self.type + def __cmp__(self, other): + return cmp(self.type, other.type) def __repr__(self): return "<SubscriptionType: %s>" % str(self) def string_tree(self, indent=0): @@ -222,8 +224,8 @@ class DiffTree (tree.Tree): self.join(root, parent, data_part) if data_part != None: depth += 1 - for child in self: - child.report(root, self, depth) + for child in self: + root = child.report(root, self, depth) return root def make_root(self): return [] @@ -481,8 +483,11 @@ class Diff (object): node.masked = False selected_by_bug = [] else: - node = root.child_by_path('bugdir/settings') - node.masked = True + try: + node = root.child_by_path('bugdir/settings') + node.masked = True + except KeyError: + pass for name,type in (('new', BUGDIR_TYPE_NEW), ('mod', BUGDIR_TYPE_MOD), ('rem', BUGDIR_TYPE_REM)): |