Show More
@@ -199,35 +199,38 b' class hgweb(object):' | |||||
199 | req.form['node'] = [fn[:-len(ext)]] |
|
199 | req.form['node'] = [fn[:-len(ext)]] | |
200 | req.form['type'] = [type_] |
|
200 | req.form['type'] = [type_] | |
201 |
|
201 | |||
202 |
# |
|
202 | # process this if it's a protocol request | |
|
203 | ||||
|
204 | cmd = req.form.get('cmd', [''])[0] | |||
|
205 | if cmd in protocol.__all__: | |||
|
206 | method = getattr(protocol, cmd) | |||
|
207 | method(self, req) | |||
|
208 | return | |||
|
209 | ||||
|
210 | # process the web interface request | |||
203 |
|
211 | |||
204 | try: |
|
212 | try: | |
205 |
|
213 | |||
206 | cmd = req.form.get('cmd', [''])[0] |
|
214 | tmpl = self.templater(req) | |
207 | if cmd in protocol.__all__: |
|
215 | ctype = tmpl('mimetype', encoding=self.encoding) | |
208 | method = getattr(protocol, cmd) |
|
216 | ctype = templater.stringify(ctype) | |
209 | method(self, req) |
|
217 | ||
210 |
|
|
218 | if cmd == '': | |
211 | tmpl = self.templater(req) |
|
219 | req.form['cmd'] = [tmpl.cache['default']] | |
212 | ctype = tmpl('mimetype', encoding=self.encoding) |
|
220 | cmd = req.form['cmd'][0] | |
213 | ctype = templater.stringify(ctype) |
|
|||
214 |
|
||||
215 | if cmd == '': |
|
|||
216 | req.form['cmd'] = [tmpl.cache['default']] |
|
|||
217 | cmd = req.form['cmd'][0] |
|
|||
218 |
|
221 | |||
219 |
|
|
222 | if cmd not in webcommands.__all__: | |
220 |
|
|
223 | msg = 'No such method: %s' % cmd | |
221 |
|
|
224 | raise ErrorResponse(HTTP_BAD_REQUEST, msg) | |
222 |
|
|
225 | elif cmd == 'file' and 'raw' in req.form.get('style', []): | |
223 |
|
|
226 | self.ctype = ctype | |
224 |
|
|
227 | content = webcommands.rawfile(self, req, tmpl) | |
225 |
|
|
228 | else: | |
226 |
|
|
229 | content = getattr(webcommands, cmd)(self, req, tmpl) | |
227 |
|
|
230 | req.respond(HTTP_OK, ctype) | |
228 |
|
231 | |||
229 |
|
|
232 | req.write(content) | |
230 |
|
|
233 | del tmpl | |
231 |
|
234 | |||
232 | except revlog.LookupError, err: |
|
235 | except revlog.LookupError, err: | |
233 | req.respond(HTTP_NOT_FOUND, ctype) |
|
236 | req.respond(HTTP_NOT_FOUND, ctype) |
General Comments 0
You need to be logged in to leave comments.
Login now