diff options
author | Marcel Hellkamp <marc@gsites.de> | 2014-03-06 16:33:51 +0100 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2014-03-06 16:33:51 +0100 |
commit | 4d06a7bbb2cb877274fea3d462513884207f162a (patch) | |
tree | 6611af78b5a80d70203de0d924e3f8b52560c670 /bottle.py | |
parent | d7780fd5d5c2baeb0152864138adbbdfcf83e6e4 (diff) | |
download | bottle-4d06a7bbb2cb877274fea3d462513884207f162a.tar.gz |
fix #595: If expressions broken in STPL after upgrading
Fixed an error where everything before a block keyword (if/for/...) was
removed by the template parser. Example::
% m = 'a' if True else 'b'
was translated to::
if True else 'b'
insead of::
m = 'a' if True else 'b'
Diffstat (limited to 'bottle.py')
-rw-r--r-- | bottle.py | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3486,6 +3486,9 @@ class StplParser(object): code_line += self.source[self.offset:self.offset+m.start()] self.offset += m.end() _str, _com, _blk1, _blk2, _end, _cend, _nl = m.groups() + if code_line and (_blk1 or _blk2): # a if b else c + code_line += _blk1 or _blk2 + continue if _str: # Python string code_line += _str elif _com: # Python comment (up to EOL) |