fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Download visit stats.
[wolnelektury.git]
/
src
/
chunks
/
templatetags
/
chunks.py
diff --git
a/src/chunks/templatetags/chunks.py
b/src/chunks/templatetags/chunks.py
index
968d284
..
e86288e
100644
(file)
--- a/
src/chunks/templatetags/chunks.py
+++ b/
src/chunks/templatetags/chunks.py
@@
-1,6
+1,10
@@
-# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from django import template
from django.core.cache import cache
from django import template
from django.core.cache import cache
+from django.utils.safestring import mark_safe
+from django.utils.translation import get_language
from ..models import Chunk, Attachment
from ..models import Chunk, Attachment
@@
-10,7
+14,7
@@
register = template.Library()
@register.simple_tag
def chunk(key, cache_time=0):
try:
@register.simple_tag
def chunk(key, cache_time=0):
try:
- cache_key = 'chunk
_' + key
+ cache_key = 'chunk
:%s:%s' % (key, get_language())
c = cache.get(cache_key)
if c is None:
c = Chunk.objects.get(key=key)
c = cache.get(cache_key)
if c is None:
c = Chunk.objects.get(key=key)
@@
-20,7
+24,7
@@
def chunk(key, cache_time=0):
n = Chunk(key=key)
n.save()
return ''
n = Chunk(key=key)
n.save()
return ''
- return
content
+ return
mark_safe(content)
@register.simple_tag
@register.simple_tag