From c670b1189f26f41f71eaa42c1270d8f1f1c1682e Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 29 Jun 2008 17:23:04 +0200 Subject: [PATCH] Skip templates with syntax errors on babel extract --HG-- branch : trunk --- jinja2/ext.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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, [] -- 2.26.2