[mentors-ops] r262 - website/cgi-bin/Mentors
mentors at lonestar.workaround.org
mentors at lonestar.workaround.org
Fri Sep 22 17:22:58 CEST 2006
Author: mentors
Date: 2006-09-22 17:22:57 +0200 (Fri, 22 Sep 2006)
New Revision: 262
Modified:
website/cgi-bin/Mentors/Importer.py
Log:
Changed the Importer.sendMail function. Use the "sendto" parameter to
specify the recipient. If "sendto" is missing the mail is sent to the
maintainer that is saved in the Importer.maintainer module variable.
(I didn't find a niftier way yet. Python gurus welcome.)
Modified: website/cgi-bin/Mentors/Importer.py
===================================================================
--- website/cgi-bin/Mentors/Importer.py 2006-09-22 15:21:36 UTC (rev 261)
+++ website/cgi-bin/Mentors/Importer.py 2006-09-22 15:22:57 UTC (rev 262)
@@ -200,14 +200,20 @@
# Send an email from a template
# template = name of the template file in templates/ directory
# values = dictionary of variables to fill
-def sendMail(template, **variables):
- if not maintainer:
- logging.error("sendMail: No maintainer set. Aborting.")
- return
+def sendMail(template, sendto=None, **variables):
+ # By default the mail gets sent to the Importer.maintainer
+ # address (a class variable). If 'sendto' is given as a parameter
+ # the mail will be sent there instead.
+ if not sendto:
+ if not maintainer:
+ logging.error("sendMail: No recipient set. Aborting.")
+ return
+ else:
+ sendto = maintainer
# Add the standard sender address to the dictionary
variables["from"]=Config.EmailSender
- variables["to"]=maintainer
+ variables["to"]=sendto
variables["package"]=package
logging.info("sendMail: Sending mail from template '%s'" % template)
More information about the mentors-ops
mailing list