Skip to content
Myr

fixed bug with parameter parsing

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 151418d · Browse files · 3 files+6 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+6 added−5 removed

  • other:+6 added−5 removed

3 files+6 added−5 removed

modified:jinja2/compiler.py+4 added-3 removed
252 unmodified lines
253 self.hard_scope = hard_scope254255 def visit_Name(self, node):256 """All assignments to names go through this function."""257 if node.ctx in ('store', 'param'):257 if node.ctx == 'store':258 self.identifiers.declared_locally.add(node.name)259 elif node.ctx == 'param':260 self.identifiers.declared_parameter.add(node.name)261 elif node.ctx == 'load' and not \262 self.identifiers.is_declared(node.name, self.hard_scope):263 self.identifiers.undeclared.add(node.name)264
7 unmodified lines
272 self.generic_visit(node)273 if isinstance(node.arg, nodes.Const) and \274 isinstance(node.arg.value, basestring) and \275 ((isinstance(node.node, nodes.Name) and274 node.node.name not in (self.identifiers.declared_locally |275 self.identifiers.declared_parameter)) or \276 node.node.name not in (self.identifiers.declared_locally)) or277 node.node in self.identifiers.static_subscribes):278 if node in self.identifiers.static_subscribes:279 self.identifiers.static_subscribes[node] += 1280 else:
1145 unmodified lines
modified:jinja2/parser.py+1 added
218 unmodified lines
219 while self.stream.current.type is not 'rparen':220 if args:221 self.stream.expect('comma')222 arg = self.parse_assign_target(name_only=True)223 arg.set_ctx('param')224 if self.stream.skip_if('assign'):225 defaults.append(self.parse_expression())226 args.append(arg)227 self.stream.expect('rparen')
528 unmodified lines
modified:jinja2/runtime.py+1 added-2 removed
119 unmodified lines
120 """121 return dict(self.parent, **self.vars)122123 def _all(meth):124 def proxy(self):125 return getattr(self.get_all(), meth)()124 proxy = lambda self: getattr(self.get_all(), meth)()125 proxy.__doc__ = getattr(dict, meth).__doc__126 proxy.__name__ = meth127 return proxy128
293 unmodified lines