src/cm/utils/cache.py
changeset 261 b60ab54b6782
parent 0 40c8f766c9b8
child 349 8d1ce1bda109
--- a/src/cm/utils/cache.py	Tue Apr 20 11:37:33 2010 +0200
+++ b/src/cm/utils/cache.py	Thu Apr 22 11:32:41 2010 +0200
@@ -1,9 +1,10 @@
 from django.core.cache import cache
+from hashlib import sha1
 
 # adapted [to django] from http://code.activestate.com/recipes/325205/
 def dj_memoize(f):
     def g(*args, **kwargs):
-        key = ( f.__name__, f, tuple(args), frozenset(kwargs.items()) )
+        key = sha1( str((f.__name__, f, tuple(args), frozenset(kwargs.items())) )).hexdigest()
         val = cache.get(key)
         if not val:
             val = f(*args, **kwargs)