X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2856ae6ae36213ca7997366e0c7790e3c855e62f..472845d4dba67935e4f5bbbfa07b54b23921dab5:/apps/catalogue/utils.py diff --git a/apps/catalogue/utils.py b/apps/catalogue/utils.py index b023f1a2f..33b0830e7 100644 --- a/apps/catalogue/utils.py +++ b/apps/catalogue/utils.py @@ -38,8 +38,12 @@ def get_random_hash(seed): return urlsafe_b64encode(sha_digest).replace('=', '').replace('_', '-').lower() -def split_tags(tags): - result = {} +def split_tags(tags, initial=None): + if initial is None: + result = {} + else: + result = initial + for tag in tags: result.setdefault(tag.category, []).append(tag) return result @@ -317,7 +321,7 @@ This can sometimes occupy lots of memory, so trim it here a bit. def related_tag_name(tag_info, language=None): return tag_info.get("name_%s" % (language or get_language()), - tag_info.get("name_%s" % settings.LANGUAGE_CODE)) + tag_info.get("name_%s" % settings.LANGUAGE_CODE, "")) def delete_from_cache_by_language(cache, key_template):