diff --git a/jabber/mailconnection.py b/jabber/mailconnection.py index 9d7eca6..d463ef0 100644 --- a/jabber/mailconnection.py +++ b/jabber/mailconnection.py @@ -193,19 +193,19 @@ class MailConnection(object): result = u"From : " for i in range(len(from_decoded)): if from_decoded[i][1]: - result += from_decoded[i][0].decode(from_decoded[i][1]) + result += unicode(from_decoded[i][0].decode(from_decoded[i][1])) else: - result += from_decoded[i][0] + result += unicode(from_decoded[i][0]) result += "\n" subject_decoded = email.Header.decode_header(email_msg["Subject"]) result += u"Subject : " for i in range(len(subject_decoded)): if subject_decoded[i][1]: - result += subject_decoded[i][0].decode(subject_decoded[i][1]) + result += unicode(subject_decoded[i][0].decode(subject_decoded[i][1])) else: - result += subject_decoded[i][0] - result += "\n\n" + result += unicode(subject_decoded[i][0]) + result += u"\n\n" if include_body: action = { @@ -215,7 +215,7 @@ class MailConnection(object): for part in email_msg.walk(): content_type = part.get_content_type() if action.has_key(content_type): - result += action[content_type](part) + '\n' + result += unicode(action[content_type](part)) + u'\n' return result def format_message_summary(self, email_msg): @@ -226,7 +226,7 @@ class MailConnection(object): def get_status_msg(self): return self.get_type() + "://" + self.login + "@" + self.host + ":" + \ - str(self.port) + unicode(self.port) def connect(self): pass diff --git a/run_test.py b/run_test.py index 012a9fd..7c8d2c9 100644 --- a/run_test.py +++ b/run_test.py @@ -1,10 +1,10 @@ ## -## test.py -## Login : -## Started on Wed May 18 13:33:03 2005 adro8400 -## $Id: run_test.py,v 1.2 2005/09/18 20:24:07 dax Exp $ +## run_test.py +## Login : +## Started on Wed May 18 13:33:03 2005 David Rousselie +## $Id: run_test.py,v 1.2 2005/09/18 20:24:07 David Rousselie Exp $ ## -## Copyright (C) 2005 adro8400 +## Copyright (C) 2005 David Rousselie ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or @@ -63,7 +63,7 @@ if __name__ == '__main__': component2_suite, \ storage_suite, \ dbmstorage_suite)) - test_support.run_suite(dbmstorage_suite) + test_support.run_suite(mail_connection_suite) # coverage.stop() # coverage.analysis(jabber.mailconnection_factory) diff --git a/tests/test_mailconnection.py b/tests/test_mailconnection.py index 00f4935..0ad0d43 100644 --- a/tests/test_mailconnection.py +++ b/tests/test_mailconnection.py @@ -1,11 +1,11 @@ -# -*- coding: iso-8859-15 -*- +# -*- coding: utf-8 -*- ## ## mailconnection_test.py -## Login : -## Started on Fri May 13 11:32:51 2005 adro8400 -## $Id: test_mailconnection.py,v 1.2 2005/09/18 20:24:07 dax Exp $ +## Login : David Rousselie +## Started on Fri May 13 11:32:51 2005 David Rousselie +## $Id: test_mailconnection.py,v 1.2 2005/09/18 20:24:07 David Rousselie Exp $ ## -## Copyright (C) 2005 adro8400 +## Copyright (C) 2005 David Rousselie ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or @@ -54,7 +54,7 @@ class MailConnection_TestCase(unittest.TestCase): test_get_decoded_part_encoded = \ make_test((True, False, False), \ lambda self, email: self.connection.get_decoded_part(email), \ - u"Encoded single part with 'iso-8859-15' charset (éàê)") + u"Encoded single part with 'iso-8859-15' charset (éàê)") test_format_message_summary_not_encoded = \ make_test((False, False, True), \ @@ -64,8 +64,8 @@ class MailConnection_TestCase(unittest.TestCase): test_format_message_summary_encoded = \ make_test((True, False, True), \ lambda self, email: self.connection.format_message_summary(email), \ - u"From : encoded from (éàê)\nSubject : encoded subject " + \ - u"(éàê)\n\n") + u"From : encoded from (éàê)\nSubject : encoded subject " + \ + u"(éàê)\n\n") test_format_message_summary_partial_encoded = \ make_test((True, False, True), \ @@ -77,8 +77,8 @@ class MailConnection_TestCase(unittest.TestCase): "\"" + str(email["From"]) \ + "\" not encoded part") or \ self.connection.format_message_summary(email), \ - u"From : \"encoded from (éàê)\" not encoded part\nSubject " + \ - u": \"encoded subject (éàê)\" not encoded part\n\n") + u"From : \"encoded from (éàê)\" not encoded part\nSubject " + \ + u": \"encoded subject (éàê)\" not encoded part\n\n") test_format_message_single_not_encoded = \ make_test((False, False, True), \ @@ -89,9 +89,9 @@ class MailConnection_TestCase(unittest.TestCase): test_format_message_single_encoded = \ make_test((True, False, True), \ lambda self, email: self.connection.format_message(email), \ - u"From : encoded from (éàê)\nSubject : encoded subject " + \ - u"(éàê)\n\nEncoded single part with 'iso-8859-15' charset" + \ - u" (\xe9\xe0\xea)\n") + u"From : encoded from (éàê)\nSubject : encoded subject " + \ + u"(éàê)\n\nEncoded single part with 'iso-8859-15' charset" + \ + u" (éàê)\n") test_format_message_multi_not_encoded = \ make_test((False, True, True), \ @@ -102,9 +102,9 @@ class MailConnection_TestCase(unittest.TestCase): test_format_message_multi_encoded = \ make_test((True, True, True), \ lambda self, email: self.connection.format_message(email), \ - u"From : encoded from (éàê)\nSubject : encoded subject (éà" + \ - u"ê)\n\nEncoded multipart1 with 'iso-8859-15' charset (éàê" + \ - u")\nEncoded multipart2 with 'iso-8859-15' charset (éàê)\n") + u"From : encoded from (éàê)\nSubject : encoded subject (éà" + \ + u"ê)\n\nEncoded multipart1 with 'iso-8859-15' charset (éàê" + \ + u")\nEncoded multipart2 with 'iso-8859-15' charset (éàê)\n") class POP3Connection_TestCase(unittest.TestCase):