[PATCH 9 of 15] Add ability to hgwebdir to specify a template path

vincent at ricardis.tudelft.nl vincent at ricardis.tudelft.nl
Wed Aug 24 16:49:17 CDT 2005


Patch subject is complete summary.


# HG changeset patch
# User Vincent Wagelaar <vincent at ricardis.tudelft.nl>
# Node ID 904616aa5d021f2a2a3b842f554d95562440c409
# Parent  d310faf347ce7998820439cb041f5f142e9daf95
Add ability to hgwebdir to specify a template path

diff -r d310faf347ce -r 904616aa5d02 mercurial/hgweb.py
--- a/mercurial/hgweb.py	Wed Aug 24 11:33:34 2005
+++ b/mercurial/hgweb.py	Wed Aug 24 11:38:14 2005
@@ -838,9 +838,10 @@
 
 # This is a stopgap
 class hgwebdir:
-    def __init__(self, config):
+    def __init__(self, config, templates=""):
         self.cp = ConfigParser.SafeConfigParser()
         self.cp.read(config)
+        self.templates = templates
 
     def run(self, stdin=sys.stdin, stdout=sys.stdout, env=os.environ):
         try:
@@ -849,11 +850,11 @@
             virtual = ""
 
         virtual = virtual.strip('/')
-
+        templates = self.templates or templatepath()
         if len(virtual):
             try:
                 real = self.cp.get("paths", virtual)
-                h = hgweb(real)
+                h = hgweb(real, None, templates)
                 h.run()
                 return
             except NoOptionError:
@@ -866,7 +867,7 @@
         def footer(**map):
             yield tmpl("footer", **map)
 
-        templates = templatepath()
+
         m = os.path.join(templates, "map")
         tmpl = templater(m, common_filters,
                          {"header": header, "footer": footer})


More information about the Mercurial mailing list