[foundation-web] bin/mail-instructions: Replaced PERL version by a Python version



commit b746ee8015352f66cf6bb23073a62eb94d33d96e
Author: Tobias Mueller <tobiasmue gnome org>
Date:   Mon May 24 00:18:47 2010 +0100

    bin/mail-instructions: Replaced PERL version by a Python version
    
    I finally came around to test the script on window. Although the Python
    script is a bit ugly, it works. Just some Python-2.4 compatibility was
    needed. In the future, we can assume to read the Template string
    directory out of the file, i.e. w/o creating $member, etc. Also, check
    whether a "$" in the token confuses the Template parser.

 bin/mail-instructions.pl |   91 ----------------------------------------------
 bin/mail-instructions.py |    7 +++-
 2 files changed, 5 insertions(+), 93 deletions(-)
---
diff --git a/bin/mail-instructions.py b/bin/mail-instructions.py
index 3284745..ce0a56f 100755
--- a/bin/mail-instructions.py
+++ b/bin/mail-instructions.py
@@ -33,7 +33,10 @@ import smtplib
 import sys
 import string
 import re
-from email.mime.text import MIMEText
+try:
+    from email.mime.text import MIMEText
+except ImportError:
+    from email.MIMEText import MIMEText
 
 re_template_fixes = [
     (re.compile(r'^(\s*Dear )<member>', re.MULTILINE), '\\1$member'),
@@ -81,7 +84,7 @@ def email_it(recipients_file, instructions_file):
             s.connect('localhost')
 
         try:
-            s.sendmail(from_header, ['olav bkor dhs org'], msg.as_string())
+            s.sendmail(from_header, [member_email,], msg.as_string())
         except smtplib.SMTPException:
             print "Error: Could not send to %s (%s)!" % (member_email, member_name)
             errors += 1



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