# HG changeset patch # User Brian Neal # Date 1458607859 18000 # Node ID 8a67a2008c130ece766b51d0652bceff96878975 # Parent 9f4eb8f055ef8afb8b3a6995356f788b712cb8ce Fix V3 bug that polluted template contexts. diff -r 9f4eb8f055ef -r 8a67a2008c13 contests/templatetags/contest_tags.py --- a/contests/templatetags/contest_tags.py Thu Mar 17 21:16:03 2016 -0500 +++ b/contests/templatetags/contest_tags.py Mon Mar 21 19:50:59 2016 -0500 @@ -13,9 +13,10 @@ @register.simple_tag(takes_context=True) def latest_contests_block(context): contests = Contest.public_objects.get_current_contests() - context['contests'] = contests - template_name = ('contests/v3/latest_contests_block_tag.html' if 'V3_DESIGN' in context else 'contests/latest_contests_block_tag.html') t = template.loader.get_template(template_name) - return t.render(context) + + with context.push(): + context['contests'] = contests + return t.render(context) diff -r 9f4eb8f055ef -r 8a67a2008c13 donations/templatetags/donations_tags.py --- a/donations/templatetags/donations_tags.py Thu Mar 17 21:16:03 2016 -0500 +++ b/donations/templatetags/donations_tags.py Mon Mar 21 19:50:59 2016 -0500 @@ -12,12 +12,13 @@ @register.simple_tag(takes_context=True) def monthly_goal(context): - context['pct'] = Donation.objects.monthly_goal_pct() - template_name = ('donations/v3/monthly_goal_tag.html' if 'V3_DESIGN' in context else 'donations/monthly_goal_tag.html') t = template.loader.get_template(template_name) - return t.render(context) + + with context.push(): + context['pct'] = Donation.objects.monthly_goal_pct() + return t.render(context) @register.inclusion_tag('donations/top_donors_tag.html') diff -r 9f4eb8f055ef -r 8a67a2008c13 irc/templatetags/irc_tags.py --- a/irc/templatetags/irc_tags.py Thu Mar 17 21:16:03 2016 -0500 +++ b/irc/templatetags/irc_tags.py Mon Mar 21 19:50:59 2016 -0500 @@ -10,6 +10,7 @@ def irc_status(context): template_name = ('irc/v3/irc_block.html' if 'V3_DESIGN' in context else 'irc/irc_block.html') - context['nicks'] = get_users() t = template.loader.get_template(template_name) - return t.render(context) + with context.push(): + context['nicks'] = get_users() + return t.render(context) diff -r 9f4eb8f055ef -r 8a67a2008c13 polls/templatetags/poll_tags.py --- a/polls/templatetags/poll_tags.py Thu Mar 17 21:16:03 2016 -0500 +++ b/polls/templatetags/poll_tags.py Mon Mar 21 19:50:59 2016 -0500 @@ -21,8 +21,9 @@ @register.simple_tag(takes_context=True) def latest_poll_block(context): polls = Poll.objects.get_current_polls() - context['polls'] = polls template_name = ('polls/v3/latest_poll_block_tag.html' if 'V3_DESIGN' in context else 'polls/latest_poll_block_tag.html') t = template.loader.get_template(template_name) - return t.render(context) + with context.push(): + context['polls'] = polls + return t.render(context) diff -r 9f4eb8f055ef -r 8a67a2008c13 potd/templatetags/potd_tags.py --- a/potd/templatetags/potd_tags.py Thu Mar 17 21:16:03 2016 -0500 +++ b/potd/templatetags/potd_tags.py Mon Mar 21 19:50:59 2016 -0500 @@ -9,9 +9,9 @@ @register.simple_tag(takes_context=True) def photo_of_the_day(context): potd = Current.objects.get_current_photo() - context['potd'] = potd template_name = ('potd/v3/potd_block.html' if 'V3_DESIGN' in context else 'potd/potd_block.html') - t = template.loader.get_template(template_name) - return t.render(context) + with context.push(): + context['potd'] = potd + return t.render(context)