# HG changeset patch # User Samuel Trégouët # Date 1441974486 -7200 # Node ID fdaa0e4b7eaf4d170999acdfde1cde572b4cd90f # Parent 72447be71b48b2240b3abcfce69b609d3b0c996b [py3k] except as diff -r 72447be71b48 -r fdaa0e4b7eaf devtools/__init__.py --- a/devtools/__init__.py Fri Sep 11 14:27:34 2015 +0200 +++ b/devtools/__init__.py Fri Sep 11 14:28:06 2015 +0200 @@ -541,7 +541,7 @@ try: subprocess.check_call(['initdb', '-D', datadir, '-E', 'utf-8', '--locale=C']) - except OSError, err: + except OSError as err: if err.errno == errno.ENOENT: raise OSError('"initdb" could not be found. ' 'You should add the postgresql bin folder to your PATH ' @@ -560,7 +560,7 @@ subprocess.check_call(['pg_ctl', 'start', '-w', '-D', datadir, '-o', options], env=env) - except OSError, err: + except OSError as err: if err.errno == errno.ENOENT: raise OSError('"pg_ctl" could not be found. ' 'You should add the postgresql bin folder to your PATH ' diff -r 72447be71b48 -r fdaa0e4b7eaf devtools/htmlparser.py --- a/devtools/htmlparser.py Fri Sep 11 14:27:34 2015 +0200 +++ b/devtools/htmlparser.py Fri Sep 11 14:28:06 2015 +0200 @@ -167,7 +167,7 @@ inpsrc.setByteStream(StringIO(data)) try: self._parser.parse(inpsrc) - except sax.SAXParseException, exc: + except sax.SAXParseException as exc: new_exc = AssertionError(u'invalid document: %s' % exc) new_exc.position = (exc._linenum, exc._colnum) raise new_exc diff -r 72447be71b48 -r fdaa0e4b7eaf ext/rest.py --- a/ext/rest.py Fri Sep 11 14:27:34 2015 +0200 +++ b/ext/rest.py Fri Sep 11 14:28:06 2015 +0200 @@ -168,7 +168,7 @@ rql = params['rql'] if vid is None: vid = params.get('vid') - except (ValueError, KeyError), exc: + except (ValueError, KeyError) as exc: msg = inliner.reporter.error('Could not parse bookmark path %s [%s].' % (bookmark.path, exc), line=lineno) prb = inliner.problematic(rawtext, rawtext, msg) @@ -182,7 +182,7 @@ vid = 'noresult' view = _cw.vreg['views'].select(vid, _cw, rset=rset) content = view.render() - except Exception, exc: + except Exception as exc: content = 'An error occurred while interpreting directive bookmark: %r' % exc set_classes(options) return [nodes.raw('', content, format='html')], [] diff -r 72447be71b48 -r fdaa0e4b7eaf rqlrewrite.py --- a/rqlrewrite.py Fri Sep 11 14:27:34 2015 +0200 +++ b/rqlrewrite.py Fri Sep 11 14:28:06 2015 +0200 @@ -427,7 +427,7 @@ def insert_varmap_snippets(self, varmap, rqlexprs, varexistsmap): try: self.init_from_varmap(varmap, varexistsmap) - except VariableFromSubQuery, ex: + except VariableFromSubQuery as ex: # variable may have been moved to a newly inserted subquery # we should insert snippet in that subquery subquery = self.select.aliases[ex.variable].query diff -r 72447be71b48 -r fdaa0e4b7eaf server/sqlutils.py --- a/server/sqlutils.py Fri Sep 11 14:27:34 2015 +0200 +++ b/server/sqlutils.py Fri Sep 11 14:28:06 2015 +0200 @@ -86,7 +86,7 @@ try: # some dbapi modules doesn't accept unicode for sql string execute(str(sql)) - except Exception, err: + except Exception as err: if cnx: cnx.rollback() failed.append(sql) diff -r 72447be71b48 -r fdaa0e4b7eaf web/cors.py --- a/web/cors.py Fri Sep 11 14:27:34 2015 +0200 +++ b/web/cors.py Fri Sep 11 14:28:06 2015 +0200 @@ -50,7 +50,7 @@ process_preflight(req, config) else: # Simple CORS or actual request process_simple(req, config) - except CORSFailed, exc: + except CORSFailed as exc: info('Cross origin resource sharing failed: %s' % exc) except CORSPreflight: info('Cross origin resource sharing: valid Preflight request %s') diff -r 72447be71b48 -r fdaa0e4b7eaf web/test/data/views.py --- a/web/test/data/views.py Fri Sep 11 14:27:34 2015 +0200 +++ b/web/test/data/views.py Fri Sep 11 14:28:06 2015 +0200 @@ -45,7 +45,7 @@ for key, value in self._cw.form.iteritems(): result_dict[key] = _recursive_replace_stream_by_content(value) return result_dict - except Exception, ex: + except Exception as ex: import traceback as tb tb.print_exc(ex)