From 42cbd94fa4d4a93fa174fa1c38ca2b117744bb7e Mon Sep 17 00:00:00 2001 From: stamparm Date: Fri, 22 Feb 2013 10:49:45 +0100 Subject: [PATCH] Better update regarding 6acb2480b851a8a788b55b8956173e5e04235161 --- lib/core/decorators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/decorators.py b/lib/core/decorators.py index 31ce7535a..ab8978c1a 100644 --- a/lib/core/decorators.py +++ b/lib/core/decorators.py @@ -13,7 +13,10 @@ def cachedmethod(f, cache={}): """ def _(*args, **kwargs): - key = (f, tuple(args), str(kwargs)) + try: + key = (f, tuple(args), frozenset(kwargs.items())) + except: + key = "".join(str(_) for _ in (f, args, kwargs)) if key not in cache: cache[key] = f(*args, **kwargs) return cache[key]