From 02e8df76adff7c4ee80e496736e7eaf939ad67de Mon Sep 17 00:00:00 2001 From: Bruno Wagner Goncalves Date: Thu, 21 Aug 2014 18:39:27 -0300 Subject: MessageCollection iterators must instantiate LeapMessage with the collection --- src/leap/mail/imap/messages.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/leap/mail/imap/messages.py b/src/leap/mail/imap/messages.py index b0b2f95..11dcd8f 100644 --- a/src/leap/mail/imap/messages.py +++ b/src/leap/mail/imap/messages.py @@ -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): -- cgit v1.2.3 From 74059fb917eba96dbdd02a3cded5dfe83d16861c Mon Sep 17 00:00:00 2001 From: Bruno Wagner Goncalves Date: Thu, 21 Aug 2014 18:40:28 -0300 Subject: Fixed some PEP8 warnings on the messages file --- src/leap/mail/imap/messages.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/leap/mail/imap/messages.py b/src/leap/mail/imap/messages.py index 11dcd8f..4e8e1a3 100644 --- a/src/leap/mail/imap/messages.py +++ b/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) -- cgit v1.2.3 From 87665f1590f00e602c01fd52a14fd7a1b01a1010 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Goncalves Date: Thu, 21 Aug 2014 19:00:27 -0300 Subject: Added changes file for the bug description --- changes/bug_messages-iterator-needs-collection | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changes/bug_messages-iterator-needs-collection diff --git a/changes/bug_messages-iterator-needs-collection b/changes/bug_messages-iterator-needs-collection new file mode 100644 index 0000000..50c67d0 --- /dev/null +++ b/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 -- cgit v1.2.3