]> err.no Git - dak/commitdiff
dont send email unless there is something to categorize
authorMike O'Connor <stew@vireo.org>
Sat, 24 Jan 2009 17:38:22 +0000 (12:38 -0500)
committerMike O'Connor <stew@vireo.org>
Sat, 24 Jan 2009 17:38:22 +0000 (12:38 -0500)
Signed-off-by: Mike O'Connor <stew@vireo.org>
dak/bts_categorize.py

index 3a3a8899f186e879cbe4158504a378dfb68f916a..11fc18c61b60ca6a3a899c222db6c973da953508 100755 (executable)
@@ -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__':