summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-09-23 10:42:25 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-09-23 10:58:03 +0200
commitde07e19f81207084e102801febeaf96680ce5d8a (patch)
tree6de657567c5928c56cb615e39065dc977da69d73 /src
parent1a1dcbd660536ad6351c6a3746a8d8f8a6a31ef9 (diff)
[bug] Make _collection_mapping a instance variable
As a class variable multiple account instances share mailboxes which is bad if its different users or tests
Diffstat (limited to 'src')
-rw-r--r--src/leap/mail/mail.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py
index 258574e..fc5abd2 100644
--- a/src/leap/mail/mail.py
+++ b/src/leap/mail/mail.py
@@ -916,17 +916,19 @@ class Account(object):
adaptor_class = SoledadMailAdaptor
- # This is a mapping to collection instances so that we always
- # return a reference to them instead of creating new ones. However, being a
- # dictionary of weakrefs values, they automagically vanish from the dict
- # when no hard refs is left to them (so they can be garbage collected)
- # This is important because the different wrappers rely on several
- # kinds of deferredLocks that are kept as class or instance variables
- _collection_mapping = weakref.WeakValueDictionary()
-
def __init__(self, store, ready_cb=None):
self.store = store
self.adaptor = self.adaptor_class()
+
+ # this is a mapping to collection instances so that we always
+ # return a reference to them instead of creating new ones. however,
+ # being a dictionary of weakrefs values, they automagically vanish
+ # from the dict when no hard refs is left to them (so they can be
+ # garbage collected) this is important because the different wrappers
+ # rely on several kinds of deferredlocks that are kept as class or
+ # instance variables
+ self._collection_mapping = weakref.WeakValueDictionary()
+
self.mbox_indexer = MailboxIndexer(self.store)
# This flag is only used from the imap service for the moment.