Mercurial > hg
comparison mercurial/hgweb/hgweb_mod.py @ 26163:84511b1d9724
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.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 22 Aug 2015 16:28:22 -0700 |
parents | 268b39770c28 |
children | e037fd28c8bb |
comparison
equal
deleted
inserted
replaced
26162:268b39770c28 | 26163:84511b1d9724 |
---|---|
81 self.configint('web', 'maxshortchanges', 60)) | 81 self.configint('web', 'maxshortchanges', 60)) |
82 object.__setattr__(self, 'maxfiles', | 82 object.__setattr__(self, 'maxfiles', |
83 self.configint('web', 'maxfiles', 10)) | 83 self.configint('web', 'maxfiles', 10)) |
84 object.__setattr__(self, 'allowpull', | 84 object.__setattr__(self, 'allowpull', |
85 self.configbool('web', 'allowpull', True)) | 85 self.configbool('web', 'allowpull', True)) |
86 | |
87 # we use untrusted=False to prevent a repo owner from using | |
88 # web.templates in .hg/hgrc to get access to any file readable | |
89 # by the user running the CGI script | |
90 object.__setattr__(self, 'templatepath', | |
91 self.config('web', 'templates', untrusted=False)) | |
86 | 92 |
87 # Proxy unknown reads and writes to the application instance | 93 # Proxy unknown reads and writes to the application instance |
88 # until everything is moved to us. | 94 # until everything is moved to us. |
89 def __getattr__(self, name): | 95 def __getattr__(self, name): |
90 return getattr(self.app, name) | 96 return getattr(self.app, name) |
156 self.repo = r | 162 self.repo = r |
157 hook.redirect(True) | 163 hook.redirect(True) |
158 self.repostate = None | 164 self.repostate = None |
159 self.mtime = -1 | 165 self.mtime = -1 |
160 self.reponame = name | 166 self.reponame = name |
161 # we use untrusted=False to prevent a repo owner from using | |
162 # web.templates in .hg/hgrc to get access to any file readable | |
163 # by the user running the CGI script | |
164 self.templatepath = self.config('web', 'templates', untrusted=False) | |
165 self.websubtable = webutil.getwebsubs(r) | 167 self.websubtable = webutil.getwebsubs(r) |
166 | 168 |
167 # The CGI scripts are often run by a user different from the repo owner. | 169 # The CGI scripts are often run by a user different from the repo owner. |
168 # Trust the settings from the .hg/hgrc files by default. | 170 # Trust the settings from the .hg/hgrc files by default. |
169 def config(self, section, name, default=None, untrusted=True): | 171 def config(self, section, name, default=None, untrusted=True): |