Reviewers: ,
Please review this at http://codereview.tryton.org/136001/ Affected files: M trytond/model/browse.py Index: trytond/model/browse.py =================================================================== --- a/trytond/model/browse.py +++ b/trytond/model/browse.py @@ -1,6 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. import contextlib +import weakref from itertools import islice, ifilter, ifilterfalse, chain from trytond.model import fields from trytond.transaction import Transaction @@ -53,7 +54,7 @@ assert isinstance(ids, list) if ids: assert record_id in ids - self._cursor = Transaction().cursor + self._cursor_weakref = weakref.ref(Transaction().cursor) self._user = Transaction().user self.id = record_id self._model = model @@ -70,6 +71,10 @@ assert isinstance(local_cache, LRUDict) self._local_data = local_cache + @property + def _cursor(self): + return self._cursor_weakref() + def __getitem__(self, name): # Access to LRUDict must be atomic result = self._local_data.get(self.id, {}).get(name) -- [email protected] mailing list
