summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-24 16:21:37 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-09-24 16:21:37 +0200
commitb87c07172fcb86b5d91fda7424489a813f4f0498 (patch)
tree35bfed10cb8bae003612931d79e1aad96dd0b371 /ishtar_common/utils.py
parent38f6d33d2153db1370a04d9dd8b11b0469725e72 (diff)
parent3120af6c41157b71561d6fd5a68fc6022f6dbadf (diff)
downloadIshtar-b87c07172fcb86b5d91fda7424489a813f4f0498.tar.bz2
Ishtar-b87c07172fcb86b5d91fda7424489a813f4f0498.zip
Merge branch 'v0.9' into wheezy
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index ca9193204..60c3ac7ef 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -17,6 +17,7 @@
# See the file COPYING for details.
+import hashlib
import random
from django.conf import settings
@@ -41,6 +42,13 @@ def get_cache(cls, extra_args=[]):
else:
cache_key += '-' + unicode(arg)
cache_key = slugify(cache_key)
+ if not cache_key.endswith('_current_keys') \
+ and hasattr(cls, '_add_cache_key_to_refresh'):
+ cls._add_cache_key_to_refresh(extra_args)
+ if len(cache_key) >= 250:
+ m = hashlib.md5()
+ m.update(cache_key)
+ cache_key = m.hexdigest()
return cache_key, cache.get(cache_key)