Skip to content
Browse files

Use Context's `push` and `pop` methods to temporarily overwrite context.

  • Loading branch information...
1 parent d82af9f commit ea7af65ea278a0e6bf16c82ed5fba50d629689fa @markotibold markotibold committed Oct 2, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 fiber/templatetags/fiber_tags.py
View
6 fiber/templatetags/fiber_tags.py
@@ -175,11 +175,15 @@ def render(self, context):
content_item.page_content_item = page_content_item
content_items.append(content_item)
+ context.push()
+ context['fiber_page'] = page
context['ContentItem'] = ContentItem
context['fiber_block_name'] = self.block_name
context['fiber_content_items'] = content_items
t = template.loader.get_template('fiber/content_items.html')
- return t.render(context)
+ content = t.render(context)
+ context.pop()
+ return content
except template.VariableDoesNotExist:
# page does not exist in the context

0 comments on commit ea7af65

Please sign in to comment.
Something went wrong with that request. Please try again.