|
 |
be8404 |
From ac70fbfb7f8349e5c1150f40bf1d21ba635d0cb8 Mon Sep 17 00:00:00 2001
|
|
 |
be8404 |
From: Chirag Jadwani <cbjadwani@elance-odesk.com>
|
|
 |
be8404 |
Date: Fri, 29 Aug 2014 13:15:35 +0530
|
|
 |
be8404 |
Subject: [PATCH] Fix AttributeError in offline compression
|
|
 |
be8404 |
|
|
 |
be8404 |
---
|
|
 |
be8404 |
compressor/offline/django.py | 2 ++
|
|
 |
be8404 |
.../test_block_super_base_compressed/test_compressor_offline.html | 5 +++++
|
|
 |
be8404 |
2 files changed, 7 insertions(+)
|
|
 |
be8404 |
|
|
 |
be8404 |
diff --git a/compressor/offline/django.py b/compressor/offline/django.py
|
|
 |
be8404 |
index 3986562..b326093 100644
|
|
 |
be8404 |
--- a/compressor/offline/django.py
|
|
 |
be8404 |
+++ b/compressor/offline/django.py
|
|
 |
be8404 |
@@ -54,6 +54,8 @@ def remove_block_nodes(nodelist, block_stack, block_context):
|
|
 |
be8404 |
if not block_stack:
|
|
 |
be8404 |
continue
|
|
 |
be8404 |
node = block_context.get_block(block_stack[-1].name)
|
|
 |
be8404 |
+ if not node:
|
|
 |
be8404 |
+ continue
|
|
 |
be8404 |
if isinstance(node, BlockNode):
|
|
 |
be8404 |
expanded_block = expand_blocknode(node, block_stack, block_context)
|
|
 |
be8404 |
new_nodelist.extend(expanded_block)
|
|
 |
be8404 |
diff --git a/compressor/tests/test_templates/test_block_super_base_compressed/test_compressor_offline.html b/compressor/tests/test_templates/test_block_super_base_compressed/test_compressor_offline.html
|
|
 |
be8404 |
index 01382ec..10097c1 100644
|
|
 |
be8404 |
--- a/compressor/tests/test_templates/test_block_super_base_compressed/test_compressor_offline.html
|
|
 |
be8404 |
+++ b/compressor/tests/test_templates/test_block_super_base_compressed/test_compressor_offline.html
|
|
 |
be8404 |
@@ -5,4 +5,9 @@
|
|
 |
be8404 |
<script type="text/javascript">
|
|
 |
be8404 |
alert("this alert shouldn't be alone!");
|
|
 |
be8404 |
</script>
|
|
 |
be8404 |
+ {% block orphan %}
|
|
 |
be8404 |
+ {{ block.super }}
|
|
 |
be8404 |
+ An 'orphan' block that refers to a non-existent super block.
|
|
 |
be8404 |
+ Contents of this block are ignored.
|
|
 |
be8404 |
+ {% endblock %}
|
|
 |
be8404 |
{% endspaceless %}{% endblock %}
|