Using str objects only and avoid the automatic quoting from imaplib.

fixes #415
This commit is contained in:
Antoine Nguyen
2013-05-10 09:39:17 +02:00
parent fe7ce46929
commit 1b40baebf5
3 changed files with 14 additions and 8 deletions
+3 -3
View File
@@ -181,7 +181,7 @@ class IMAPconnector(object):
raise ImapError(e)
if typ == "NO":
raise ImapError(data)
if not kwargs.has_key('responses'):
if not 'responses' in kwargs:
if not name in self.m.untagged_responses:
return None
return self.m.untagged_responses.pop(name)
@@ -283,14 +283,14 @@ class IMAPconnector(object):
:param order: sorting order
:param folder: mailbox to scan
"""
if "order" in kwargs.keys() and kwargs["order"]:
if "order" in kwargs and kwargs["order"]:
sign = kwargs["order"][:1]
criterion = kwargs["order"][1:].upper()
if sign == '-':
criterion = "REVERSE %s" % criterion
else:
criterion = "REVERSE DATE"
folder = kwargs.has_key("folder") and kwargs["folder"] or None
folder = kwargs["folder"] if "folder" in kwargs else None
# FIXME: pourquoi suis je obligé de faire un SELECT ici? un
# EXAMINE plante mais je pense que c'est du à une mauvaise
+10 -4
View File
@@ -149,13 +149,19 @@ class ImapListing(EmailListing):
int(parameters.get_user(user, "REFRESH_INTERVAL")) * 1000
def parse_search_parameters(self, criterion, pattern):
def or_criterion(old, c):
if old == "":
return c
return "OR (%s) (%s)" % (old, c)
if criterion == "both":
criterion = "from_addr, subject"
if criterion == u"both":
criterion = u"from_addr, subject"
criterions = ""
if type(pattern) is unicode:
pattern = pattern.encode("utf-8")
if type(criterion) is unicode:
criterion = criterion.encode("utf-8")
for c in criterion.split(','):
if c == "from_addr":
key = "FROM"
@@ -164,8 +170,8 @@ class ImapListing(EmailListing):
else:
continue
criterions = \
unicode(or_criterion(criterions, '%s "%s"' % (key, pattern)))
self.mbc.criterions = [unicode("(%s)" % criterions)]
or_criterion(criterions, '(%s "%s")' % (key, pattern))
self.mbc.criterions = [criterions]
@staticmethod
def computequota(mbc):
+1 -1
View File
@@ -21,7 +21,7 @@
}
});
if (this.options.navobj.params.pattern != undefined) {
this.$element.attr("value", this.options.navobj.params.pattern);
this.$element.attr("value", this.options.navobj.getparam("pattern"));
}
if (this.options.navobj.params.criteria != undefined) {
$("#crit_" + this.options.navobj.params.criteria).attr("checked", "checked");