From ed2dfb68d04860b3778688fe99e99115a93b4170 Mon Sep 17 00:00:00 2001 From: richard Date: Sat, 15 Dec 2001 23:48:35 +0000 Subject: [PATCH] Added ROUNDUPDBSENDMAILDEBUG so one can test the sendmail method without actually sending mail :) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@470 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/roundupdb.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 6cb939a..e6c3e88 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -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 base64, mimetypes 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 @@ class IssueClass(Class): # 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 @@ class IssueClass(Class): # # $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:) -- 2.30.2