diff mercurial/hgweb/webcommands.py @ 5600:9d900f7282e6

hgweb: explicitly pass around the templater
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 03 Dec 2007 13:30:08 +0100
parents d534ba1c4eb4
children a0e20a5eba3c
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Dec 03 12:40:29 2007 +0100
+++ b/mercurial/hgweb/webcommands.py	Mon Dec 03 13:30:08 2007 +0100
@@ -9,24 +9,24 @@
 from mercurial import revlog
 from common import staticfile
 
-def log(web, req):
+def log(web, req, tmpl):
     if req.form.has_key('file') and req.form['file'][0]:
-        filelog(web, req)
+        filelog(web, req, tmpl)
     else:
-        changelog(web, req)
+        changelog(web, req, tmpl)
 
-def file(web, req):
+def file(web, req, tmpl):
     path = web.cleanpath(req.form.get('file', [''])[0])
     if path:
         try:
-            req.write(web.filerevision(web.filectx(req)))
+            req.write(web.filerevision(tmpl, web.filectx(req)))
             return
         except revlog.LookupError:
             pass
 
-    req.write(web.manifest(web.changectx(req), path))
+    req.write(web.manifest(tmpl, web.changectx(req), path))
 
-def changelog(web, req, shortlog = False):
+def changelog(web, req, tmpl, shortlog = False):
     if req.form.has_key('node'):
         ctx = web.changectx(req)
     else:
@@ -37,52 +37,52 @@
         try:
             ctx = web.repo.changectx(hi)
         except hg.RepoError:
-            req.write(web.search(hi)) # XXX redirect to 404 page?
+            req.write(web.search(tmpl, hi)) # XXX redirect to 404 page?
             return
 
-    req.write(web.changelog(ctx, shortlog = shortlog))
+    req.write(web.changelog(tmpl, ctx, shortlog = shortlog))
 
-def shortlog(web, req):
-    changelog(web, req, shortlog = True)
+def shortlog(web, req, tmpl):
+    changelog(web, req, tmpl, shortlog = True)
 
-def changeset(web, req):
-    req.write(web.changeset(web.changectx(req)))
+def changeset(web, req, tmpl):
+    req.write(web.changeset(tmpl, web.changectx(req)))
 
 rev = changeset
 
-def manifest(web, req):
-    req.write(web.manifest(web.changectx(req),
+def manifest(web, req, tmpl):
+    req.write(web.manifest(tmpl, web.changectx(req),
                            web.cleanpath(req.form['path'][0])))
 
-def tags(web, req):
-    req.write(web.tags())
+def tags(web, req, tmpl):
+    req.write(web.tags(tmpl))
 
-def summary(web, req):
-    req.write(web.summary())
+def summary(web, req, tmpl):
+    req.write(web.summary(tmpl))
 
-def filediff(web, req):
-    req.write(web.filediff(web.filectx(req)))
+def filediff(web, req, tmpl):
+    req.write(web.filediff(tmpl, web.filectx(req)))
 
 diff = filediff
 
-def annotate(web, req):
-    req.write(web.fileannotate(web.filectx(req)))
+def annotate(web, req, tmpl):
+    req.write(web.fileannotate(tmpl, web.filectx(req)))
 
-def filelog(web, req):
-    req.write(web.filelog(web.filectx(req)))
+def filelog(web, req, tmpl):
+    req.write(web.filelog(tmpl, web.filectx(req)))
 
-def archive(web, req):
+def archive(web, req, tmpl):
     type_ = req.form['type'][0]
     allowed = web.configlist("web", "allow_archive")
     if (type_ in web.archives and (type_ in allowed or
         web.configbool("web", "allow" + type_, False))):
-        web.archive(req, req.form['node'][0], type_)
+        web.archive(tmpl, req, req.form['node'][0], type_)
         return
 
-    req.respond(400, web.t('error',
+    req.respond(400, tmpl('error',
                            error='Unsupported archive type: %s' % type_))
 
-def static(web, req):
+def static(web, req, tmpl):
     fname = req.form['file'][0]
     # a repo owner may set web.static in .hg/hgrc to get any file
     # readable by the user running the CGI script