hgweb: do not use unassigned variables in exception handling
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 01 Aug 2008 12:33:10 +0200
changeset 6853 2ff0829bdae5
parent 6851 6ec941b6003d
child 6854 9d11faecb0f1
hgweb: do not use unassigned variables in exception handling
mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Jul 30 22:26:41 2008 +0200
+++ b/mercurial/hgweb/webcommands.py	Fri Aug 01 12:33:10 2008 +0200
@@ -53,16 +53,15 @@
 
 def file(web, req, tmpl):
     path = web.cleanpath(req.form.get('file', [''])[0])
-    if path:
+    if not path:
+        return web.manifest(tmpl, web.changectx(req), path)
+    try:
+        return web.filerevision(tmpl, web.filectx(req))
+    except revlog.LookupError, inst:
         try:
-            return web.filerevision(tmpl, web.filectx(req))
-        except revlog.LookupError, inst:
-            pass
-
-    try:
-        return web.manifest(tmpl, web.changectx(req), path)
-    except ErrorResponse:
-        raise inst
+            return web.manifest(tmpl, web.changectx(req), path)
+        except ErrorResponse:
+            raise inst
 
 def changelog(web, req, tmpl, shortlog = False):
     if 'node' in req.form: