diff --git a/compressor/offline/django.py b/compressor/offline/django.py index 3986562..b326093 100644 --- a/compressor/offline/django.py +++ b/compressor/offline/django.py @@ -54,6 +54,8 @@ def remove_block_nodes(nodelist, block_stack, block_context): if not block_stack: continue node = block_context.get_block(block_stack[-1].name) + if not node: + continue if isinstance(node, BlockNode): expanded_block = expand_blocknode(node, block_stack, block_context) new_nodelist.extend(expanded_block) 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 index 01382ec..10097c1 100644 --- 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 @@ -5,4 +5,9 @@ + {% block orphan %} + {{ block.super }} + An 'orphan' block that refers to a non-existent super block. + Contents of this block are ignored. + {% endblock %} {% endspaceless %}{% endblock %}