diff mercurial/hgweb/hgwebdir_mod.py @ 3275:db9d2a624521

hgweb: Search templates in templatepath/style/map, too, using a common function. This allows for web templates to be self-contained in a directory, which makes copying and modifying them easier.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 06 Oct 2006 18:28:50 +0200
parents 3207e30bf468
children 415905fad4fe
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -11,7 +11,7 @@ from mercurial.demandload import demandl
 demandload(globals(), "ConfigParser mimetools cStringIO")
 demandload(globals(), "mercurial:ui,hg,util,templater")
 demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb")
-demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile")
+demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile,style_map")
 from mercurial.i18n import gettext as _
 
 # This is a stopgap
@@ -69,17 +69,11 @@ class hgwebdir(object):
         def footer(**map):
             yield tmpl("footer", motd=self.motd, **map)
 
-        m = os.path.join(templater.templatepath(), "map")
         style = self.style
         if req.form.has_key('style'):
             style = req.form['style'][0]
-        if style != "":
-            b = os.path.basename("map-" + style)
-            p = os.path.join(templater.templatepath(), b)
-            if os.path.isfile(p):
-                m = p
-
-        tmpl = templater.templater(m, templater.common_filters,
+        mapfile = style_map(templater.templatepath(), style)
+        tmpl = templater.templater(mapfile, templater.common_filters,
                                    defaults={"header": header,
                                              "footer": footer})