equal
deleted
inserted
replaced
6 # This software may be used and distributed according to the terms of the |
6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. |
7 # GNU General Public License version 2 or any later version. |
8 |
8 |
9 import os |
9 import os |
10 from mercurial import ui, hg, hook, error, encoding, templater |
10 from mercurial import ui, hg, hook, error, encoding, templater |
11 from common import get_mtime, ErrorResponse, permhooks |
11 from common import get_mtime, ErrorResponse, permhooks, caching |
12 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
12 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
13 from request import wsgirequest |
13 from request import wsgirequest |
14 import webcommands, protocol, webutil |
14 import webcommands, protocol, webutil |
15 |
15 |
16 perms = { |
16 perms = { |
176 |
176 |
177 if cmd == '': |
177 if cmd == '': |
178 req.form['cmd'] = [tmpl.cache['default']] |
178 req.form['cmd'] = [tmpl.cache['default']] |
179 cmd = req.form['cmd'][0] |
179 cmd = req.form['cmd'][0] |
180 |
180 |
|
181 caching(self, req) # sets ETag header or raises NOT_MODIFIED |
181 if cmd not in webcommands.__all__: |
182 if cmd not in webcommands.__all__: |
182 msg = 'no such method: %s' % cmd |
183 msg = 'no such method: %s' % cmd |
183 raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
184 raise ErrorResponse(HTTP_BAD_REQUEST, msg) |
184 elif cmd == 'file' and 'raw' in req.form.get('style', []): |
185 elif cmd == 'file' and 'raw' in req.form.get('style', []): |
185 self.ctype = ctype |
186 self.ctype = ctype |