Replaced loop with dictionary comprehension.

This commit is contained in:
Toivo Mattila 2018-12-20 01:31:48 +02:00 committed by Tim Graham
parent 8d3147e130
commit 78dc7039bc
1 changed files with 1 additions and 4 deletions

View File

@ -127,12 +127,9 @@ class BlockTranslateNode(Node):
message_context = self.message_context.resolve(context) message_context = self.message_context.resolve(context)
else: else:
message_context = None 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 # Update() works like a push(), so corresponding context.pop() is at
# the end of function # 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) singular, vars = self.render_token_list(self.singular)
if self.plural and self.countervar and self.counter: if self.plural and self.countervar and self.counter:
count = self.counter.resolve(context) count = self.counter.resolve(context)