summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-12-07 23:13:48 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-12-07 23:13:48 +0100
commit74711e058edeb66d0e3cfb9f8277cab0accf2519 (patch)
tree99eb36b978bf9538e3c75e86dad00891f8995ca2 /ishtar_common/utils.py
parent3eb736d29728193d957bf2c1184768b2b2c2f3b0 (diff)
downloadIshtar-74711e058edeb66d0e3cfb9f8277cab0accf2519.tar.bz2
Ishtar-74711e058edeb66d0e3cfb9f8277cab0accf2519.zip
No town label fix (refs #2980)
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index f50031d5d..65bd1ee15 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -21,6 +21,7 @@ from django.core.cache import cache
from django.utils.translation import ugettext
from django.template.defaultfilters import slugify
+
def get_cache(cls, extra_args=[]):
cache_key = cls.__name__
for arg in extra_args:
@@ -36,6 +37,7 @@ def get_cache(cls, extra_args=[]):
cache_key = slugify(cache_key)
return cache_key, cache.get(cache_key)
+
def cached_label_changed(sender, **kwargs):
if not kwargs.get('instance'):
return
@@ -46,7 +48,9 @@ def cached_label_changed(sender, **kwargs):
instance.save()
SHORTIFY_STR = ugettext(" (...)")
+
+
def shortify(lbl, number=20):
if len(lbl) <= number:
return lbl
- return lbl[:number-len(SHORTIFY_STR)] + SHORTIFY_STR
+ return lbl[:number - len(SHORTIFY_STR)] + SHORTIFY_STR