diff roundup/roundupdb.py @ 458:fcda73536034

Added ROUNDUPDBSENDMAILDEBUG so one can test the sendmail method... ...without actually sending mail :)
author Richard Jones <richard@users.sourceforge.net>
date Sat, 15 Dec 2001 23:48:35 +0000
parents 5b422e3bd05d
children 9c895b44240a
line wrap: on
line diff
--- a/roundup/roundupdb.py	Sat Dec 15 23:47:47 2001 +0000
+++ b/roundup/roundupdb.py	Sat Dec 15 23:48:35 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.31 2001-12-15 19:24:39 rochecompaan Exp $
+# $Id: roundupdb.py,v 1.32 2001-12-15 23:48:35 richard Exp $
 
 __doc__ = """
 Extending hyperdb with types specific to issue-tracking.
@@ -27,6 +27,9 @@
 
 import hyperdb, date
 
+# set to indicate to roundup not to actually _send_ email
+ROUNDUPDBSENDMAILDEBUG = os.environ.get('ROUNDUPDBSENDMAILDEBUG', '')
+
 class DesignatorError(ValueError):
     pass
 def splitDesignator(designator, dre=re.compile(r'([^\d]+)(\d+)')):
@@ -401,10 +404,14 @@
 
         # now try to send the message
         try:
-            smtp = smtplib.SMTP(self.MAILHOST)
-            # send the message as admin so bounces are sent there instead
-            # of to roundup
-            smtp.sendmail(self.ADMIN_EMAIL, sendto, message.getvalue())
+            if ROUNDUPDBSENDMAILDEBUG:
+                print 'From: %s\nTo: %s\n%s\n=-=-=-=-=-=-=-='%(
+                    self.ADMIN_EMAIL, sendto, message.getvalue())
+            else:
+                smtp = smtplib.SMTP(self.MAILHOST)
+                # send the message as admin so bounces are sent there instead
+                # of to roundup
+                smtp.sendmail(self.ADMIN_EMAIL, sendto, message.getvalue())
         except socket.error, value:
             raise MessageSendError, \
                 "Couldn't send confirmation email: mailhost %s"%value
@@ -497,6 +504,13 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.31  2001/12/15 19:24:39  rochecompaan
+#  . Modified cgi interface to change properties only once all changes are
+#    collected, files created and messages generated.
+#  . Moved generation of change note to nosyreactors.
+#  . We now check for changes to "assignedto" to ensure it's added to the
+#    nosy list.
+#
 # Revision 1.30  2001/12/12 21:47:45  richard
 #  . Message author's name appears in From: instead of roundup instance name
 #    (which still appears in the Reply-To:)

Roundup Issue Tracker: http://roundup-tracker.org/