diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-27 17:04:42 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-27 17:04:42 -0400 |
commit | 59f6dd7c96df1cb33ad9b409574cab1c26b12243 (patch) | |
tree | 85731aafeb03d58e2705ac70cf0dc00a301423d1 /interfaces/email/interactive/be-handle-mail | |
parent | cce10d1dfaacbd1110894a42d477cab036413dc8 (diff) | |
download | bugseverywhere-59f6dd7c96df1cb33ad9b409574cab1c26b12243.tar.gz |
be-handle-mail no longer sends blank subscriber emails when no change occurs.
It had been mailing out the empty MIMEMultipart root returned by
diff_tree.report().
Diffstat (limited to 'interfaces/email/interactive/be-handle-mail')
-rwxr-xr-x | interfaces/email/interactive/be-handle-mail | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/interfaces/email/interactive/be-handle-mail b/interfaces/email/interactive/be-handle-mail index 5120f94..1d02ccf 100755 --- a/interfaces/email/interactive/be-handle-mail +++ b/interfaces/email/interactive/be-handle-mail @@ -296,8 +296,18 @@ class DiffTree (libbe.diff.DiffTree): bugdir/bugs/mod/a/comments/rem bugdir/bugs/mod/a/comments/mod """ + def report_or_none(self): + report = self.report() + payload = report.get_payload() + if payload == None or len(payload) == 0: + return None + return report def report_string(self): - return send_pgp_mime.flatten(self.report(), to_unicode=True) + report = self.report_or_none() + if report == None: + return "No changes" + else: + return send_pgp_mime.flatten(self.report(), to_unicode=True) def make_root(self): return MIMEMultipart() def join(self, root, parent, data_part): @@ -612,15 +622,16 @@ class Message (object): for id,types in subscriptions.items(): if id == "DIR": if subscribe.BUGDIR_TYPE_ALL in types: - parts.append(diff_tree.report()) + parts.append(diff_tree.report_or_none()) break if subscribe.BUGDIR_TYPE_NEW in types: new = diff_tree.child_by_path("/bugs/new") - parts.append(new.report()) + parts.append(new.report_or_none()) continue # move on to next id assert types == [subscribe.BUG_TYPE_ALL], types type,bug_root = bug_index[id] - parts.append(bug_root.report()) + parts.append(bug_root.report_or_none()) + parts = [p for p in parts if p != None] if len(parts) == 0: continue # no email to this subscriber elif len(parts) == 1: |