summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2018-12-01 17:35:14 +0100
committerMarcel Hellkamp <marc@gsites.de>2018-12-01 17:38:55 +0100
commit0c3db605e927e6a58cefaecae3a3c6ef1e34dad5 (patch)
treee1d0788689ce5579dc442f53850f87afb29f374e
parentd6e1330d546ecd6b742c64bcad43fa9b26647e22 (diff)
downloadbottle-0c3db605e927e6a58cefaecae3a3c6ef1e34dad5.tar.gz
Fix #930: DeprecationWarning: Flags not at the start of the expression
Backported from 0.13-dev
-rw-r--r--bottle.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bottle.py b/bottle.py
index fd663f7..dae4f56 100644
--- a/bottle.py
+++ b/bottle.py
@@ -3420,7 +3420,7 @@ class StplParser(object):
_re_cache = {} #: Cache for compiled re patterns
# This huge pile of voodoo magic splits python code into 8 different tokens.
# 1: All kinds of python strings (trust me, it works)
- _re_tok = '((?m)[urbURB]?(?:\'\'(?!\')|""(?!")|\'{6}|"{6}' \
+ _re_tok = '([urbURB]?(?:\'\'(?!\')|""(?!")|\'{6}|"{6}' \
'|\'(?:[^\\\\\']|\\\\.)+?\'|"(?:[^\\\\"]|\\\\.)+?"' \
'|\'{3}(?:[^\\\\]|\\\\.|\\n)+?\'{3}' \
'|"{3}(?:[^\\\\]|\\\\.|\\n)+?"{3}))'
@@ -3443,8 +3443,9 @@ class StplParser(object):
# Match the start tokens of code areas in a template
_re_split = '(?m)^[ \t]*(\\\\?)((%(line_start)s)|(%(block_start)s))(%%?)'
# Match inline statements (may contain python strings)
- _re_inl = '%%(inline_start)s((?:%s|[^\'"\n]*?)+)%%(inline_end)s' % _re_inl
-
+ _re_inl = '(?m)%%(inline_start)s((?:%s|[^\'"\n]*?)+)%%(inline_end)s' % _re_inl
+ _re_tok = '(?m)' + _re_tok
+
default_syntax = '<% %> % {{ }}'
def __init__(self, source, syntax=None, encoding='utf8'):