MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:C Miller Date:July 1 2008 7:12pm
Subject:bzr commit into mysql_plugins branch (bzrdev:119)
View as plain text  
#At file:///Users/cmiller/.bazaar/plugins/mysql/

  119 C Miller	2008-07-01 [merge]
      Merge from trunk.
modified:
  emailer.py

=== modified file 'emailer.py'
--- a/emailer.py	2008-07-01 18:56:27 +0000
+++ b/emailer.py	2008-07-01 19:11:38 +0000
@@ -133,6 +133,7 @@ class EmailSender(object):
     def search_for_bugs(self, commit_message):
         """ scan entire log output for mentions of bugs, worklogs """
 
+        assert isinstance(commit_message, unicode)
         self.bug_ids_found = list(set(re.findall(r"(?i)\bbug[ ]*#[ ]*(\d+)",
                                                  commit_message.encode("utf8"))))
         self.worklog_ids_found = list(set(re.findall(r"(?i)\bwl[ ]*#[ ]*(\d+)",
@@ -154,7 +155,7 @@ class EmailSender(object):
         produces the body of the email
         """
         if self._body is None:
-            self._body = ""
+            self._body = u""
         return self._body
 
     def get_diff(self):
@@ -263,7 +264,8 @@ class EmailSender(object):
             SMTPConnection(self.config).send_email(self.get_message())
         else:
             mutter("sending using process")
-            Sendmail(self.config).send_email(self.get_message(), sender=self.from_address())
+            Sendmail(self.config).send_email(self.get_message(),
+                sender=parseaddr(self.from_address())[1])
 
     def headers(self, commit_message):
         the_headers = [ ('X-CSetKey',str(self.new_revid)),
@@ -317,13 +319,18 @@ class EmailSender(object):
 
 
     def per_file_messages_as_string(self, a_revision):
-        """ Concatenates all file messages for inclusion in the email """
+        """Concatenates all file messages for inclusion in the email,
+        returning a utf-8 encoded string."""
         # see revisionview.py in bzr-gtk plugin: per-file messages are in
         # property 'file-info' and bencode/decode-d.
         file_info = a_revision.properties.get('file-info', None)
         if file_info is None:
             return ''
-        file_info = bencode.bdecode(file_info.encode('UTF-8'))
+
+        if isinstance(file_info, unicode):
+            file_info = file_info.encode("utf-8")
+
+        file_info = bencode.bdecode(file_info)
         if not file_info:
             return ''
         text = ''
@@ -427,6 +434,7 @@ class CommitSender(EmailSender):
             # Decode the stuff planned for output to get Unicode.
             self._body = outf.getvalue().decode(self.encoding, 'replace')
 
+        assert isinstance(self._body, unicode)
         return self._body
 
 class PushSender(EmailSender):
@@ -470,6 +478,7 @@ class PushSender(EmailSender):
             self._body = outf.getvalue().decode(self.encoding, 'replace')
             note("Sending post-push message")
 
+        assert isinstance(self._body, unicode)
         return self._body
 
     def get_diff(self):

Thread
bzr commit into mysql_plugins branch (bzrdev:119) C Miller2 Jul