diff mercurial/hgweb/hgweb_mod.py @ 4084:51e52db6b40d

hgweb: allow static files to be served directly by the HTTP server
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 15 Feb 2007 08:51:32 -0200
parents a3aa97171546
children 49237d6ae97d
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -772,6 +772,9 @@ class hgweb(object):
         port = req.env["SERVER_PORT"]
         port = port != "80" and (":" + port) or ""
         urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port)
+        staticurl = self.config("web", "staticurl") or req.url + 'static/'
+        if not staticurl.endswith('/'):
+            staticurl += '/'
 
         if not self.reponame:
             self.reponame = (self.config("web", "name")
@@ -780,6 +783,7 @@ class hgweb(object):
 
         self.t = templater.templater(mapfile, templater.common_filters,
                                      defaults={"url": req.url,
+                                               "staticurl": staticurl,
                                                "urlbase": urlbase,
                                                "repo": self.reponame,
                                                "header": header,