summaryrefslogtreecommitdiff
path: root/bottle.py
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2014-03-06 16:33:51 +0100
committerMarcel Hellkamp <marc@gsites.de>2014-03-06 16:33:51 +0100
commit4d06a7bbb2cb877274fea3d462513884207f162a (patch)
tree6611af78b5a80d70203de0d924e3f8b52560c670 /bottle.py
parentd7780fd5d5c2baeb0152864138adbbdfcf83e6e4 (diff)
downloadbottle-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.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/bottle.py b/bottle.py
index a6f0c06..77f6f83 100644
--- a/bottle.py
+++ b/bottle.py
@@ -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)