From e1fb2bd080b45a2677993fb0ff2f40bfecdca0ee Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 13 Jun 2016 15:11:56 +0200 Subject: [PATCH] [IMP] qweb: improve regular expressions --- openerp/addons/base/ir/ir_qweb/qweb.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb/qweb.py b/openerp/addons/base/ir/ir_qweb/qweb.py index 9909a4a3c2a..34026927554 100644 --- a/openerp/addons/base/ir/ir_qweb/qweb.py +++ b/openerp/addons/base/ir/ir_qweb/qweb.py @@ -198,13 +198,8 @@ def foreach_iterator(base_ctx, enum, name): base_ctx[k] = ctx[k] _FORMAT_REGEX = re.compile( - '(?:' - # ruby-style pattern - '#\{(.+?)\}' - ')|(?:' - # jinja-style pattern - '\{\{(.+?)\}\}' - ')') + # ( ruby-style )|( jinja-style ) + r'(?:#\{(.+?)\})|(?:\{\{(.+?)\}\})') class frozendict(dict): @@ -899,7 +894,7 @@ class QWeb(object): debugger = el.attrib.pop('t-debug') body = self._compile_directives(el, options) if options['dev_mode']: - body = ast.parse("__import__('%s').set_trace()" % re.sub('[^a-zA-Z]', '', debugger)).body + body # pdb, ipdb, pudb, ... + body = ast.parse("__import__('%s').set_trace()" % re.sub(r'[^a-zA-Z]', '', debugger)).body + body # pdb, ipdb, pudb, ... else: _logger.warning("@t-debug in template is only available in dev mode options") return body