[Python-checkins] r70409 - in tracker/roundup-src/roundup: cgi/client.py mailer.py

martin.v.loewis python-checkins at python.org
Mon Mar 16 00:59:46 CET 2009


Author: martin.v.loewis
Date: Mon Mar 16 00:59:46 2009
New Revision: 70409

Log:
get_standard_message does not anymore return a tuple,
but an email Message.


Modified:
   tracker/roundup-src/roundup/cgi/client.py
   tracker/roundup-src/roundup/mailer.py

Modified: tracker/roundup-src/roundup/cgi/client.py
==============================================================================
--- tracker/roundup-src/roundup/cgi/client.py	(original)
+++ tracker/roundup-src/roundup/cgi/client.py	Mon Mar 16 00:59:46 2009
@@ -1029,15 +1029,14 @@
                 to = [self.mailer.config.ADMIN_EMAIL]
                 subject = "Templating Error: %s" % exc_info[1]
                 content = cgitb.pt_html()
-                message, writer = self.mailer.get_standard_message(
-                    to, subject)
-                writer.addheader('Content-Transfer-Encoding', 'quoted-printable')
-                body = writer.startbody('text/html; charset=utf-8')
-                content = StringIO(content)
-                quopri.encode(content, body, 0)
-                self.mailer.smtp_send(to, message)
+                message = self.mailer.get_standard_message(to, subject)
+                # delete existing content-type headers
+                del message['Content-type']
+                message['Content-type'] = 'text/html; charset=utf-8'
+                message.set_payload(content)
+                self.mailer.smtp_send(to, str(message))
                 # Now report the error to the user.
-                return self._(error_message)
+                return self._(self.error_message)
             except:
                 # Reraise the original exception.  The user will
                 # receive an error message, and the adminstrator will

Modified: tracker/roundup-src/roundup/mailer.py
==============================================================================
--- tracker/roundup-src/roundup/mailer.py	(original)
+++ tracker/roundup-src/roundup/mailer.py	Mon Mar 16 00:59:46 2009
@@ -55,7 +55,7 @@
         Subject and author are encoded using the EMAIL_CHARSET from the
         config (default UTF-8).
 
-        Returns a Message object and body part writer.
+        Returns a Message object.
         '''
         # encode header values if they need to be
         charset = getattr(self.config, 'EMAIL_CHARSET', 'utf-8')


More information about the Python-checkins mailing list