rev 3596 - in debbugs-illa: . bts

Pierre Habouzit madcoder at costa.debian.org
Tue Apr 18 17:49:26 UTC 2006


Author: madcoder
Date: 2006-04-18 17:49:26 +0000 (Tue, 18 Apr 2006)
New Revision: 3596

Modified:
   debbugs-illa/bts/mailer.py
   debbugs-illa/bzlink.py
   debbugs-illa/bzsync.py
   debbugs-illa/config.py
Log:
add Config.Debug setting: make it True and scripts don't send mails
anymore.

useful for devel purposes.



Modified: debbugs-illa/bts/mailer.py
===================================================================
--- debbugs-illa/bts/mailer.py	2006-04-18 17:46:16 UTC (rev 3595)
+++ debbugs-illa/bts/mailer.py	2006-04-18 17:49:26 UTC (rev 3596)
@@ -32,9 +32,11 @@
 from email.MIMEText import MIMEText
 
 class BtsMailer:
-    def __init__(self):
-        self.smtp = smtplib.SMTP()
-        self.smtp.connect()
+    def __init__(self, fake = False):
+        self.fake = fake
+        if not self.fake:
+            self.smtp = smtplib.SMTP()
+            self.smtp.connect()
 
     def BtsMail(self, body):
         msg = MIMEText(body)
@@ -44,8 +46,12 @@
         return msg
 
     def sendmail(self, From, To, Msg):
-        self.smtp.sendmail(From, To, Msg)
+        if self.fake:
+            print Msg
+        else:
+            self.smtp.sendmail(From, To, Msg)
 
     def unlink(self):
-        self.smtp.close()
+        if not self.fake:
+            self.smtp.close()
 

Modified: debbugs-illa/bzlink.py
===================================================================
--- debbugs-illa/bzlink.py	2006-04-18 17:46:16 UTC (rev 3595)
+++ debbugs-illa/bzlink.py	2006-04-18 17:49:26 UTC (rev 3596)
@@ -115,7 +115,7 @@
         to_send.append(processBzMsg(bz.BzNotif(fp)))
     fp.close()
 
-    mailer = bts.BtsMailer()
+    mailer = bts.BtsMailer(Config.Debug)
     for body, to in to_send:
         msg = mailer.BtsMail(body)
         msg['From'] = Config.From

Modified: debbugs-illa/bzsync.py
===================================================================
--- debbugs-illa/bzsync.py	2006-04-18 17:46:16 UTC (rev 3595)
+++ debbugs-illa/bzsync.py	2006-04-18 17:49:26 UTC (rev 3596)
@@ -86,7 +86,7 @@
     else: usage(1)
 
     rep = bzi.getReport(bzBug)
-    mailer = bts.BtsMailer()
+    mailer = bts.BtsMailer(Config.Debug)
 
     msg = mailer.BtsMail(prepareMail(bug, rep, fwd))
     msg['From'] = Config.From

Modified: debbugs-illa/config.py
===================================================================
--- debbugs-illa/config.py	2006-04-18 17:46:16 UTC (rev 3595)
+++ debbugs-illa/config.py	2006-04-18 17:49:26 UTC (rev 3596)
@@ -30,6 +30,8 @@
 ###############################################################################
 
 class Config:
+    Debug = False
+
     Bugzilla = "http://bugs.kde.org"
     Ldap = 'ldap://bts2ldap.debian.net:10101'
     From = 'debian-qt-kde at lists.debian.org'




More information about the pkg-kde-commits mailing list