summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2014-08-22 11:26:57 -0500
committerRuben Pollan <meskio@sindominio.net>2014-08-22 11:26:57 -0500
commitdfc2cb3cc5bd5f38234253a2a0c960b6581d8e88 (patch)
treef19e9175fc95e37dcd6b9d091f54f82daeed41e6
parentf95c3ea07d9353771eb45c06e1dd14a50d3528a7 (diff)
parent05d852e5bbdc526d0dc257d0355c68d6d2d43282 (diff)
Merge branch 'bwgpro/fix_message_iterator' into develop
-rw-r--r--mail/changes/bug_messages-iterator-needs-collection2
-rw-r--r--mail/src/leap/mail/imap/messages.py10
2 files changed, 7 insertions, 5 deletions
diff --git a/mail/changes/bug_messages-iterator-needs-collection b/mail/changes/bug_messages-iterator-needs-collection
new file mode 100644
index 00000000..50c67d09
--- /dev/null
+++ b/mail/changes/bug_messages-iterator-needs-collection
@@ -0,0 +1,2 @@
+ o MessageCollection iterator now creates the LeapMessage with the collection
+ reference, so setFlags will work properly
diff --git a/mail/src/leap/mail/imap/messages.py b/mail/src/leap/mail/imap/messages.py
index b0b2f953..4e8e1a3c 100644
--- a/mail/src/leap/mail/imap/messages.py
+++ b/mail/src/leap/mail/imap/messages.py
@@ -750,7 +750,7 @@ class MessageCollection(WithMsgFields, IndexedDB, MBoxParser):
:return: a dict with the template
:rtype: dict
"""
- if not _type in self.templates.keys():
+ if _type not in self.templates.keys():
raise TypeError("Improper type passed to _get_empty_doc")
return copy.deepcopy(self.templates[_type])
@@ -938,10 +938,10 @@ class MessageCollection(WithMsgFields, IndexedDB, MBoxParser):
# We can say the observer that we're done at this point, but
# before that we should make sure it has no serious consequences
# if we're issued, for instance, a fetch command right after...
- #self.reactor.callFromThread(observer.callback, uid)
+ # self.reactor.callFromThread(observer.callback, uid)
# if we did the notify, we need to invalidate the deferred
# so not to try to fire it twice.
- #observer = None
+ # observer = None
fd = self._populate_flags(flags, uid, chash, size, multi)
hd = self._populate_headr(msg, chash, subject, date)
@@ -1337,7 +1337,7 @@ class MessageCollection(WithMsgFields, IndexedDB, MBoxParser):
:returns: a list of LeapMessages
:rtype: list
"""
- return [LeapMessage(self._soledad, docid, self.mbox)
+ return [LeapMessage(self._soledad, docid, self.mbox, collection=self)
for docid in self.unseen_iter()]
# recent messages
@@ -1370,7 +1370,7 @@ class MessageCollection(WithMsgFields, IndexedDB, MBoxParser):
:returns: iterator of dicts with content for all messages.
:rtype: iterable
"""
- return (LeapMessage(self._soledad, docuid, self.mbox)
+ return (LeapMessage(self._soledad, docuid, self.mbox, collection=self)
for docuid in self.all_uid_iter())
def __repr__(self):