From: Armin Ronacher Date: Sun, 29 Jun 2008 15:23:04 +0000 (+0200) Subject: Skip templates with syntax errors on babel extract X-Git-Tag: 2.0~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c670b1189f26f41f71eaa42c1270d8f1f1c1682e;p=jinja2.git Skip templates with syntax errors on babel extract --HG-- branch : trunk --- diff --git a/jinja2/ext.py b/jinja2/ext.py index 4d68983..0f30d54 100644 --- a/jinja2/ext.py +++ b/jinja2/ext.py @@ -425,7 +425,11 @@ def babel_extract(fileobj, keywords, comment_tags, options): ) source = fileobj.read().decode(options.get('encoding', 'utf-8')) - node = environment.parse(source) + try: + node = environment.parse(source) + except TemplateSyntaxError, e: + # skip templates with syntax errors + return for lineno, func, message in extract_from_ast(node, keywords): yield lineno, func, message, []