168 # The CGI scripts are often run by a user different from the repo owner. |
168 # The CGI scripts are often run by a user different from the repo owner. |
169 # Trust the settings from the .hg/hgrc files by default. |
169 # Trust the settings from the .hg/hgrc files by default. |
170 def config(self, section, name, default=None, untrusted=True): |
170 def config(self, section, name, default=None, untrusted=True): |
171 return self.repo.ui.config(section, name, default, |
171 return self.repo.ui.config(section, name, default, |
172 untrusted=untrusted) |
172 untrusted=untrusted) |
173 |
|
174 def configbool(self, section, name, default=False, untrusted=True): |
|
175 return self.repo.ui.configbool(section, name, default, |
|
176 untrusted=untrusted) |
|
177 |
173 |
178 def _getview(self, repo): |
174 def _getview(self, repo): |
179 """The 'web.view' config controls changeset filter to hgweb. Possible |
175 """The 'web.view' config controls changeset filter to hgweb. Possible |
180 values are ``served``, ``visible`` and ``all``. Default is ``served``. |
176 values are ``served``, ``visible`` and ``all``. Default is ``served``. |
181 The ``served`` filter only shows changesets that can be pulled from the |
177 The ``served`` filter only shows changesets that can be pulled from the |
340 |
336 |
341 if cmd == '': |
337 if cmd == '': |
342 req.form['cmd'] = [tmpl.cache['default']] |
338 req.form['cmd'] = [tmpl.cache['default']] |
343 cmd = req.form['cmd'][0] |
339 cmd = req.form['cmd'][0] |
344 |
340 |
345 if self.configbool('web', 'cache', True): |
341 if rctx.configbool('web', 'cache', True): |
346 caching(self, req) # sets ETag header or raises NOT_MODIFIED |
342 caching(self, req) # sets ETag header or raises NOT_MODIFIED |
347 if cmd not in webcommands.__all__: |
343 if cmd not in webcommands.__all__: |
348 msg = 'no such method: %s' % cmd |
344 msg = 'no such method: %s' % cmd |
349 raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
345 raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
350 elif cmd == 'file' and 'raw' in req.form.get('style', []): |
346 elif cmd == 'file' and 'raw' in req.form.get('style', []): |