Skip to content
Myr

[svn] minor reindenting in the jinja parser

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 33d528a · Browse files · 1 file+12 added−17 removed
This commit

State

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

Diff stats

1 file+12 added−17 removed

  • other:+12 added−17 removed

1 file+12 added−17 removed

modified:jinja/parser.py+12 added-17 removed
114 unmodified lines
115 def handle_for_directive(self, lineno, gen):116 """117 Handle a for directive and return a ForLoop node118 """119 #XXX: maybe we could make the "recurse" part optional by using120 # a static analysis later.119 recursive = []120 def wrapgen():121 """Wrap the generator to check if we have a recursive for loop."""122 for token in gen:
227 unmodified lines
350 """351 def process_variable(lineno, token, name):352 if token != 'name':353 raise TemplateSyntaxError('can only use variable not '356 'constants or expressions '357 'in translation variable '358 'blocks.', lineno,359 self.filename)354 'constants or expressions in '355 'translation variable blocks.',356 lineno, self.filename)357 # plural name without trailing "_"? that's a keyword358 if not name.endswith('_'):362 raise TemplateSyntaxError('illegal use of keyword '363 "'%s' as identifier in "364 'trans block.' %365 name, lineno, self.filename)359 raise TemplateSyntaxError('illegal use of keyword \'%s\' as'360 'identifier in translatable block.'361 % name, lineno, self.filename)362 name = name[:-1]363 if name not in replacements:368 raise TemplateSyntaxError('unregistered translation '369 "variable '%s'." %370 name, lineno,364 raise TemplateSyntaxError('unregistered translation variable'365 " '%s'." % name, lineno,366 self.filename)367 # check that we don't have an expression here, thus the368 # next token *must* be a variable_end token (or a369 # block_end token when in no_variable_block mode)370 next_token = self.tokenstream.next()[1]371 if next_token != 'variable_end' and not \372 (self.no_variable_block and next_token == 'block_end'):373 raise TemplateSyntaxError('you cannot use variable '379 'expressions inside trans '380 'tags. apply filters '381 'in the trans header.',382 lineno, self.filename)374 'expressions inside translatable '375 'tags. apply filters in the'376 'trans header.', lineno,377 self.filename)378 buf.append('%%(%s)s' % name)379380 # save the initial line number for the resulting node381 flineno = lineno
446 unmodified lines