# HG changeset patch # User Mads Kiilerich # Date 2013-02-10 17:24:29 # Node ID 76ff3a715cf2db991032df27e2ca0ab7044dccae # Parent 3e92772d53833323c55e2b8492facb2b0f26b0c8 hgweb: simplify internal staticfile return codes diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py +++ b/mercurial/hgweb/common.py @@ -129,7 +129,7 @@ def staticfile(directory, fname, req): for part in parts: if (part in ('', os.curdir, os.pardir) or os.sep in part or os.altsep is not None and os.altsep in part): - return "" + return fpath = os.path.join(*parts) if isinstance(directory, str): directory = [directory] @@ -144,7 +144,6 @@ def staticfile(directory, fname, req): data = fp.read() fp.close() req.respond(HTTP_OK, ct, body=data) - return "" except TypeError: raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') except OSError, err: diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -197,7 +197,8 @@ class hgwebdir(object): if isinstance(tp, str): tp = [tp] static = [os.path.join(p, 'static') for p in tp] - return (staticfile(static, fname, req),) + staticfile(static, fname, req) + return [] # top-level index elif not virtual: diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -842,7 +842,8 @@ def static(web, req, tmpl): if isinstance(tp, str): tp = [tp] static = [os.path.join(p, 'static') for p in tp] - return [staticfile(static, fname, req)] + staticfile(static, fname, req) + return [] def graph(web, req, tmpl):