Reviewers: ,
Please review this at http://codereview.tryton.org/642002/ Affected files: M trytond/cache.py Index: trytond/cache.py =================================================================== --- a/trytond/cache.py +++ b/trytond/cache.py @@ -7,6 +7,17 @@ from trytond.backend import Database from trytond.tools import OrderedDict +__all__ = ['Cache', 'LRUDict'] + + +def freeze(o): + if isinstance(o, (set, tuple, list)): + return tuple(freeze(x) for x in o) + elif isinstance(o, dict): + return frozenset((x, freeze(y)) for x, y in o.iteritems()) + else: + return o + class Cache(object): """ @@ -27,7 +38,7 @@ def _key(self, key): if self.context: - return (key, Transaction().user, repr(Transaction().context)) + return (key, Transaction().user, freeze(Transaction().context)) return key def get(self, key, default=None): -- -- [email protected] mailing list
