Make a copy of offline context before using

The offline context dictionary can be changed by the extends node (or a subclass like django-overextends).
To prevent carrying over state from previous parsings, make a copy of the offline context.
This commit is contained in:
Stefan Wehrmeyer
2015-07-29 15:56:37 +02:00
committed by Matt Westcott
parent 5654b0506d
commit 7e47c0b4da

View File

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