[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] dont send email unless there is something to categorize



Signed-off-by: Mike O'Connor <stew@vireo.org>
---
 dak/bts_categorize.py |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/dak/bts_categorize.py b/dak/bts_categorize.py
index 3a3a889..11fc18c 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__':
-- 
1.5.6.5



Reply to: