diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-22 15:56:05 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-22 15:56:05 +0100 |
commit | 1e8e5770654ef637ff6a8056473389c8c31961a4 (patch) | |
tree | 4baa9dba19f49bed1e3332608b0f6fb718438e39 /alot | |
parent | a813c0d8f4512009d0a91d4fa0639a67ee580880 (diff) |
use string_decode or __str__i instead of unicode
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/globals.py | 2 | ||||
-rw-r--r-- | alot/message.py | 7 | ||||
-rw-r--r-- | alot/widgets.py | 7 |
3 files changed, 9 insertions, 7 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 71c5768d..86ad801e 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -429,7 +429,7 @@ class ComposeCommand(Command): #get To header if 'To' not in self.mail: - name, addr = email.Utils.parseaddr(unicode(self.mail.get('From'))) + name, addr = email.Utils.parseaddr(self.mail.get('From')) a = ui.accountman.get_account_by_address(addr) allbooks = not settings.config.getboolean('general', diff --git a/alot/message.py b/alot/message.py index ec5bef34..3afb048a 100644 --- a/alot/message.py +++ b/alot/message.py @@ -297,9 +297,10 @@ class Attachment(object): self.part = emailpart def __str__(self): - return '%s:%s (%s)' % (self.get_content_type(), - self.get_filename(), - helper.humanize_size(self.get_size())) + desc = '%s:%s (%s)' % (self.get_content_type(), + self.get_filename(), + helper.humanize_size(self.get_size())) + return string_decode(desc) def get_filename(self): """return the filename, extracted from content-disposition header""" diff --git a/alot/widgets.py b/alot/widgets.py index 393c9198..6cc6fda8 100644 --- a/alot/widgets.py +++ b/alot/widgets.py @@ -24,6 +24,7 @@ from settings import config from helper import shorten_author_string from helper import pretty_datetime from helper import tag_cmp +from helper import string_decode import message @@ -167,7 +168,7 @@ class ThreadlineWidget(urwid.AttrMap): class BufferlineWidget(urwid.Text): def __init__(self, buffer): self.buffer = buffer - line = '[' + buffer.typename + '] ' + unicode(buffer) + line = '[' + buffer.typename + '] ' + buffer.__str__() urwid.Text.__init__(self, line, wrap='clip') def selectable(self): @@ -248,7 +249,7 @@ class CompleteEdit(urwid.Edit): self.historypos = None if not isinstance(edit_text, unicode): - edit_text = unicode(edit_text, errors='replace') + edit_text = string_decode(edit_text) self.start_completion_pos = len(edit_text) self.completions = None urwid.Edit.__init__(self, edit_text=edit_text, **kwargs) @@ -560,7 +561,7 @@ class AttachmentWidget(urwid.WidgetWrap): self.attachment = attachment if not isinstance(attachment, message.Attachment): self.attachment = message.Attachment(self.attachment) - widget = urwid.AttrMap(urwid.Text(unicode(self.attachment)), + widget = urwid.AttrMap(urwid.Text(self.attachment.__str__()), 'message_attachment', 'message_attachment_focussed') urwid.WidgetWrap.__init__(self, widget) |