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