changeset 18645:76ff3a715cf2

hgweb: simplify internal staticfile return codes
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 10 Feb 2013 18:24:29 +0100
parents 3e92772d5383
children c6a81e54c209
files mercurial/hgweb/common.py mercurial/hgweb/hgwebdir_mod.py mercurial/hgweb/webcommands.py
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/common.py	Sun Feb 10 18:24:29 2013 +0100
+++ b/mercurial/hgweb/common.py	Sun Feb 10 18:24:29 2013 +0100
@@ -129,7 +129,7 @@
     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 @@
         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:
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Feb 10 18:24:29 2013 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sun Feb 10 18:24:29 2013 +0100
@@ -197,7 +197,8 @@
                         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:
--- a/mercurial/hgweb/webcommands.py	Sun Feb 10 18:24:29 2013 +0100
+++ b/mercurial/hgweb/webcommands.py	Sun Feb 10 18:24:29 2013 +0100
@@ -842,7 +842,8 @@
         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):