hgweb: move templatepath to requestcontext
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 22 Aug 2015 16:28:22 -0700
changeset 26163 84511b1d9724
parent 26162 268b39770c28
child 26164 e037fd28c8bb
hgweb: move templatepath to requestcontext This does change behavior in that the templatepath could change during the lifetime of the server. But everything else can change, I don't see why template paths can't.
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Sat Aug 22 15:40:33 2015 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Aug 22 16:28:22 2015 -0700
@@ -84,6 +84,12 @@
         object.__setattr__(self, 'allowpull',
                            self.configbool('web', 'allowpull', True))
 
+        # we use untrusted=False to prevent a repo owner from using
+        # web.templates in .hg/hgrc to get access to any file readable
+        # by the user running the CGI script
+        object.__setattr__(self, 'templatepath',
+                           self.config('web', 'templates', untrusted=False))
+
     # Proxy unknown reads and writes to the application instance
     # until everything is moved to us.
     def __getattr__(self, name):
@@ -158,10 +164,6 @@
         self.repostate = None
         self.mtime = -1
         self.reponame = name
-        # we use untrusted=False to prevent a repo owner from using
-        # web.templates in .hg/hgrc to get access to any file readable
-        # by the user running the CGI script
-        self.templatepath = self.config('web', 'templates', untrusted=False)
         self.websubtable = webutil.getwebsubs(r)
 
     # The CGI scripts are often run by a user different from the repo owner.