Commit 5bcd3fe8 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Use except Type as var instead of the deprecated except Type, var.

parent 3060b20d
......@@ -596,7 +596,7 @@ class Environment(object):
source, filename, _ = self.loader.get_source(self, name)
try:
code = self.compile(source, name, filename, True, True)
except TemplateSyntaxError, e:
except TemplateSyntaxError as e:
if not ignore_errors:
raise
log_function('Could not compile "%s": %s' % (name, e))
......
......@@ -595,7 +595,7 @@ def babel_extract(fileobj, keywords, comment_tags, options):
try:
node = environment.parse(source)
tokens = list(environment.lex(environment.preprocess(source)))
except TemplateSyntaxError, e:
except TemplateSyntaxError:
# skip templates with syntax errors
return
......
......@@ -526,7 +526,7 @@ class Lexer(object):
value = self._normalize_newlines(value[1:-1]) \
.encode('ascii', 'backslashreplace') \
.decode('unicode-escape')
except Exception, e:
except Exception as e:
msg = str(e).split(':')[-1].strip()
raise TemplateSyntaxError(msg, lineno, name, filename)
# if we can express it as bytestring (ascii only)
......
......@@ -47,7 +47,7 @@ try:
raise TypeError(_test_gen_bug)
yield None
_concat(_test_gen_bug())
except TypeError, _error:
except TypeError as _error:
if not _error.args or _error.args[0] is not _test_gen_bug:
def concat(gen):
try:
......@@ -221,7 +221,7 @@ def open_if_exists(filename, mode='rb'):
"""
try:
return open(filename, mode)
except IOError, e:
except IOError as e:
if e.errno not in (errno.ENOENT, errno.EISDIR):
raise
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment