diff mercurial/hgweb/webcommands.py @ 45398:dc9fe90bdbd5

hgweb: let staticfile() look up path from default location unless provided This reduces duplication between the two callers. Differential Revision: https://phab.mercurial-scm.org/D8934
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 22 Aug 2020 16:03:44 -0700
parents da3b7c80aa34
children 914ca0a98518
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Aug 03 22:40:05 2020 -0700
+++ b/mercurial/hgweb/webcommands.py	Sat Aug 22 16:03:44 2020 -0700
@@ -36,7 +36,6 @@
     revsetlang,
     scmutil,
     smartset,
-    templater,
     templateutil,
 )
 
@@ -1318,12 +1317,7 @@
     # a repo owner may set web.static in .hg/hgrc to get any file
     # readable by the user running the CGI script
     static = web.config(b"web", b"static", untrusted=False)
-    if not static:
-        tp = web.templatepath or templater.templatedir()
-        if tp is not None:
-            static = os.path.join(tp, b'static')
-
-    staticfile(static, fname, web.res)
+    staticfile(web.templatepath, static, fname, web.res)
     return web.res.sendresponse()