Skip to content

Commit

Permalink
Replaced loop with dictionary comprehension.
Browse files Browse the repository at this point in the history
  • Loading branch information
toivomattila authored and timgraham committed Dec 19, 2018
1 parent 8d3147e commit 78dc703
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions django/templatetags/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,9 @@ def render(self, context, nested=False):
message_context = self.message_context.resolve(context)
else:
message_context = None
tmp_context = {}
for var, val in self.extra_context.items():
tmp_context[var] = val.resolve(context)
# Update() works like a push(), so corresponding context.pop() is at
# the end of function
context.update(tmp_context)
context.update({var: val.resolve(context) for var, val in self.extra_context.items()})
singular, vars = self.render_token_list(self.singular)
if self.plural and self.countervar and self.counter:
count = self.counter.resolve(context)
Expand Down

0 comments on commit 78dc703

Please sign in to comment.