Merge pull request #670 from gasman/fix/overextends

Make a copy of offline context before using
This commit is contained in:
Mathieu Pillard
2015-10-02 14:13:23 +02:00
7 changed files with 22 additions and 1 deletions

View File

@@ -26,7 +26,7 @@ def handle_extendsnode(extendsnode, block_context=None, original=None):
extendsnode.nodelist.get_nodes_by_type(BlockNode))
block_context.add_blocks(blocks)
context = Context(settings.COMPRESS_OFFLINE_CONTEXT)
context = Context(dict(settings.COMPRESS_OFFLINE_CONTEXT))
if original is not None:
context.template = original

View File

@@ -23,6 +23,7 @@ INSTALLED_APPS = [
'compressor',
'coffin',
'sekizai',
'overextends',
]
if django.VERSION < (1, 8):
INSTALLED_APPS.append('jingo')

View File

@@ -644,3 +644,10 @@ class OfflineCompressJingoTestCase(OfflineTestCaseMixin, TestCase):
env.globals['url_for'] = url_for
return env
class OfflineGenerationOverextendsTestCase(OfflineTestCaseMixin, TestCase):
templates_dir = "test_overextends"
expected_hash = "e993b2a53994"
# overextends not supported for Jinja2 yet.
engines = ("django",)

View File

@@ -0,0 +1,7 @@
{% load compress %}{% spaceless %}
{% compress js %}
<script type="text/javascript">
alert("test overextends");
</script>
{% endcompress %}
{% endspaceless %}

View File

@@ -0,0 +1 @@
{% overextends "base.html" %}

View File

@@ -9,3 +9,4 @@ unittest2==1.0.0
coffin==0.4.0
jingo==0.7
django-sekizai==0.8.2
django-overextends==0.4.0

View File

@@ -11,6 +11,7 @@ two =
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
two_six =
flake8==2.4.0
coverage==3.7.1
@@ -23,6 +24,7 @@ two_six =
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
three =
flake8==2.4.0
coverage==3.7.1
@@ -34,6 +36,7 @@ three =
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
three_two =
flake8==2.4.0
coverage==3.7.1
@@ -45,6 +48,7 @@ three_two =
jingo==0.7
coffin==0.4.0
django-sekizai==0.8.2
django-overextends==0.4.0
[tox]
envlist =
{py26,py27}-1.4.X,