comparison mercurial/hgweb/webcommands.py @ 25660:328739ea70c3

global: mass rewrite to use modern exception syntax Python 2.6 introduced the "except type as instance" syntax, replacing the "except type, instance" syntax that came before. Python 3 dropped support for the latter syntax. Since we no longer support Python 2.4 or 2.5, we have no need to continue supporting the "except type, instance". This patch mass rewrites the exception syntax to be Python 2.6+ and Python 3 compatible. This patch was produced by running `2to3 -f except -w -n .`.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 23 Jun 2015 22:20:08 -0700
parents 85fb416f2fa7
children a103ecb8a04a
comparison
equal deleted inserted replaced
25659:d60678a567a9 25660:328739ea70c3
74 req.respond(HTTP_OK, web.ctype) 74 req.respond(HTTP_OK, web.ctype)
75 return content 75 return content
76 76
77 try: 77 try:
78 fctx = webutil.filectx(web.repo, req) 78 fctx = webutil.filectx(web.repo, req)
79 except error.LookupError, inst: 79 except error.LookupError as inst:
80 try: 80 try:
81 content = manifest(web, req, tmpl) 81 content = manifest(web, req, tmpl)
82 req.respond(HTTP_OK, web.ctype) 82 req.respond(HTTP_OK, web.ctype)
83 return content 83 return content
84 except ErrorResponse: 84 except ErrorResponse:
158 path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0]) 158 path = webutil.cleanpath(web.repo, req.form.get('file', [''])[0])
159 if not path: 159 if not path:
160 return manifest(web, req, tmpl) 160 return manifest(web, req, tmpl)
161 try: 161 try:
162 return _filerevision(web, req, tmpl, webutil.filectx(web.repo, req)) 162 return _filerevision(web, req, tmpl, webutil.filectx(web.repo, req))
163 except error.LookupError, inst: 163 except error.LookupError as inst:
164 try: 164 try:
165 return manifest(web, req, tmpl) 165 return manifest(web, req, tmpl)
166 except ErrorResponse: 166 except ErrorResponse:
167 raise inst 167 raise inst
168 168