Skip to content

Commit

Permalink
Try to convert as last as possible.
Browse files Browse the repository at this point in the history
see #85
  • Loading branch information
tonioo committed Jul 24, 2017
1 parent 2608f55 commit 5572bb9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modoboa_webmail/lib/imaputils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def or_criterion(old, c):
criterions = or_criterion(
criterions, '(%s "%s")' % (key, pattern))
if six.PY3:
criterions = bytes(criterions, "utf-8")
criterions = bytearray(criterions, "utf-8")
elif isinstance(criterions, unicode):
criterions = criterions.encode("utf-8")
self.criterions = [criterions]
Expand All @@ -347,11 +347,11 @@ def messages_count(self, **kwargs):
"""
if "order" in kwargs and kwargs["order"]:
sign = kwargs["order"][:1]
criterion = bytes(kwargs["order"][1:].upper(), "utf-8")
criterion = kwargs["order"][1:].upper()
if sign == '-':
criterion = b"REVERSE %s" % criterion
criterion = "REVERSE %s" % criterion
else:
criterion = b"REVERSE DATE"
criterion = "REVERSE DATE"
folder = kwargs["folder"] if "folder" in kwargs else None

# FIXME: pourquoi suis je obligé de faire un SELECT ici? un
Expand All @@ -361,8 +361,8 @@ def messages_count(self, **kwargs):
cmdname = "SORT" if six.PY3 else b"SORT"
data = self._cmd(
cmdname,
b"(%s)" % criterion, b"UTF-8", b"(NOT DELETED)",
*self.criterions)
bytearray("(%s)" % criterion, "utf-8"),
b"UTF-8", b"(NOT DELETED)", *self.criterions)
self.messages = data[0].decode().split()
self.getquota(folder)
return len(self.messages)
Expand Down

0 comments on commit 5572bb9

Please # to comment.