summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-09 20:10:46 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-09 20:10:46 -0300
commit9cbc3dbef54c3c8ba1fa4a35bfd261e877a65f35 (patch)
tree89c34078290042d9c77e62c56d7f2838b283fa52 /mail
parent3e447f6e281313de5926e1438ccff64bb298e879 (diff)
parentd479e8f572f979c2510c4450757f8f422b210775 (diff)
Merge remote-tracking branch 'refs/remotes/ivan/feature/remove-unneded-code' into develop
Diffstat (limited to 'mail')
-rw-r--r--mail/src/leap/mail/imap/account.py33
1 files changed, 7 insertions, 26 deletions
diff --git a/mail/src/leap/mail/imap/account.py b/mail/src/leap/mail/imap/account.py
index 215564ea..ce830796 100644
--- a/mail/src/leap/mail/imap/account.py
+++ b/mail/src/leap/mail/imap/account.py
@@ -36,23 +36,6 @@ from leap.soledad.client import Soledad
#######################################
-def _unicode_as_str(text):
- """
- Return some representation of C{text} as a str.
-
- This is here mainly because Twisted's exception methods are not able to
- print unicode text.
-
- :param text: The text to convert.
- :type text: unicode
-
- :return: A representation of C{text} as str.
- :rtype: str
- """
- # XXX is there a better str representation for unicode?
- return repr(text)
-
-
class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
"""
An implementation of IAccount and INamespacePresenteer
@@ -146,8 +129,7 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
name = self._parse_mailbox_name(name)
if name not in self.mailboxes:
- raise imap4.MailboxException("No such mailbox: %s" %
- _unicode_as_str(name))
+ raise imap4.MailboxException("No such mailbox: %r" % name)
return SoledadMailbox(name, soledad=self._soledad)
@@ -173,7 +155,7 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
name = self._parse_mailbox_name(name)
if name in self.mailboxes:
- raise imap4.MailboxCollision, _unicode_as_str(name)
+ raise imap4.MailboxCollision(repr(name))
if not creation_ts:
# by default, we pass an int value
@@ -259,8 +241,7 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
name = self._parse_mailbox_name(name)
if not name in self.mailboxes:
- raise imap4.MailboxException("No such mailbox: %s" %
- _unicode_as_str(name))
+ raise imap4.MailboxException("No such mailbox: %r" % name)
mbox = self.getMailbox(name)
@@ -299,14 +280,14 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
newname = self._parse_mailbox_name(newname)
if oldname not in self.mailboxes:
- raise imap4.NoSuchMailbox, _unicode_as_str(oldname)
+ raise imap4.NoSuchMailbox(repr(oldname))
inferiors = self._inferiorNames(oldname)
inferiors = [(o, o.replace(oldname, newname, 1)) for o in inferiors]
for (old, new) in inferiors:
if new in self.mailboxes:
- raise imap4.MailboxCollision, _unicode_as_str(new)
+ raise imap4.MailboxCollision(repr(new))
for (old, new) in inferiors:
mbox = self._get_mailbox_by_name(old)
@@ -387,8 +368,8 @@ class SoledadBackedAccount(WithMsgFields, IndexedDB, MBoxParser):
"""
name = self._parse_mailbox_name(name)
if name not in self.subscriptions:
- raise imap4.MailboxException, \
- "Not currently subscribed to %s" % _unicode_as_str(name)
+ raise imap4.MailboxException(
+ "Not currently subscribed to %r" % name)
self._set_subscription(name, False)
def listMailboxes(self, ref, wildcard):