From: Mike O'Connor Date: Sat, 24 Jan 2009 17:38:22 +0000 (-0500) Subject: dont send email unless there is something to categorize X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;ds=sidebyside;h=14b618e262caa8d5eec3da81d06c7a3c11576708;p=dak.git dont send email unless there is something to categorize Signed-off-by: Mike O'Connor --- diff --git a/dak/bts_categorize.py b/dak/bts_categorize.py index 3a3a8899..11fc18c6 100755 --- a/dak/bts_categorize.py +++ b/dak/bts_categorize.py @@ -124,14 +124,14 @@ class BugClassifier(object): return retval def email_text(self): - controls = 'user ftp.debian.org@packages.debian.org\n' + controls = "" bc = BugClassifier() for bug in bc.unclassified_bugs(): controls += bc.classify_bug(bug) - return controls - + if controls: + return 'user ftp.debian.org@packages.debian.org\n' + controls import smtplib import email.Message @@ -182,11 +182,14 @@ def main(): body = BugClassifier().email_text() - if Options["Simulate"]: - print body + if body: + if Options["Simulate"]: + print body + else: + send_email(body) else: - send_email(body) + log.info( "nothing to do" ) if __name__ == '__main__':