From f495437db9b0618dff8a1316d2453e4b319feae2 Mon Sep 17 00:00:00 2001 From: "ced@b2ck.com" Date: Sat, 29 Dec 2007 14:47:25 +0100 Subject: [PATCH] Fix cache to be unique by object instance --- trytond/tools/misc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trytond/tools/misc.py b/trytond/tools/misc.py index bb99d87088..2b0ce2323c 100644 --- a/trytond/tools/misc.py +++ b/trytond/tools/misc.py @@ -339,6 +339,7 @@ class Cache(object): def __call__(self, function): arg_names = inspect.getargspec(function)[0][2:] + def cached_result(self2, cursor=None, *args, **kwargs): if cursor is None: self.cache = {} @@ -350,7 +351,8 @@ class Cache(object): kwargs.sort() # Work out key as a tuple of ('argname', value) pairs - key = (('dbname', cursor.dbname), str(kwargs)) + key = (('dbname', cursor.dbname), ('object', str(self2)), + str(kwargs)) # Check cache and return cached value if possible if key in self.cache: