comparison mercurial/hgweb/webcommands.py @ 6853:2ff0829bdae5

hgweb: do not use unassigned variables in exception handling
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 01 Aug 2008 12:33:10 +0200
parents 782dbbdfb1d7
children e8c2dae47799
comparison
equal deleted inserted replaced
6851:6ec941b6003d 6853:2ff0829bdae5
51 req.respond(HTTP_OK, mt, path, len(text)) 51 req.respond(HTTP_OK, mt, path, len(text))
52 return [text] 52 return [text]
53 53
54 def file(web, req, tmpl): 54 def file(web, req, tmpl):
55 path = web.cleanpath(req.form.get('file', [''])[0]) 55 path = web.cleanpath(req.form.get('file', [''])[0])
56 if path: 56 if not path:
57 return web.manifest(tmpl, web.changectx(req), path)
58 try:
59 return web.filerevision(tmpl, web.filectx(req))
60 except revlog.LookupError, inst:
57 try: 61 try:
58 return web.filerevision(tmpl, web.filectx(req)) 62 return web.manifest(tmpl, web.changectx(req), path)
59 except revlog.LookupError, inst: 63 except ErrorResponse:
60 pass 64 raise inst
61
62 try:
63 return web.manifest(tmpl, web.changectx(req), path)
64 except ErrorResponse:
65 raise inst
66 65
67 def changelog(web, req, tmpl, shortlog = False): 66 def changelog(web, req, tmpl, shortlog = False):
68 if 'node' in req.form: 67 if 'node' in req.form:
69 ctx = web.changectx(req) 68 ctx = web.changectx(req)
70 else: 69 else: