mercurial/hgweb/hgweb_mod.py
changeset 5964 1cd1582ef25f
parent 5963 5be210afe1b8
child 5976 9f1e6ab76069
equal deleted inserted replaced
5963:5be210afe1b8 5964:1cd1582ef25f
   212                     cmd = req.form['cmd'][0]
   212                     cmd = req.form['cmd'][0]
   213 
   213 
   214                 if cmd not in webcommands.__all__:
   214                 if cmd not in webcommands.__all__:
   215                     raise ErrorResponse(400, 'No such method: ' + cmd)
   215                     raise ErrorResponse(400, 'No such method: ' + cmd)
   216                 elif cmd == 'file' and 'raw' in req.form.get('style', []):
   216                 elif cmd == 'file' and 'raw' in req.form.get('style', []):
   217                     webcommands.rawfile(self, req, tmpl)
   217                     content = webcommands.rawfile(self, req, tmpl)
   218                 else:
   218                 else:
   219                     getattr(webcommands, cmd)(self, req, tmpl)
   219                     content = getattr(webcommands, cmd)(self, req, tmpl)
   220 
   220 
       
   221                 req.write(content)
   221                 del tmpl
   222                 del tmpl
   222 
   223 
   223         except revlog.LookupError, err:
   224         except revlog.LookupError, err:
   224             req.respond(404, tmpl(
   225             req.respond(404, tmpl(
   225                         'error', error='revision not found: %s' % err.name))
   226                         'error', error='revision not found: %s' % err.name))
   226         except (hg.RepoError, revlog.RevlogError), inst:
   227         except (hg.RepoError, revlog.RevlogError), inst:
   227             req.respond('500 Internal Server Error',
   228             req.respond(500, tmpl('error', error=str(inst)))
   228                         tmpl('error', error=str(inst)))
       
   229         except ErrorResponse, inst:
   229         except ErrorResponse, inst:
   230             req.respond(inst.code, tmpl('error', error=inst.message))
   230             req.respond(inst.code, tmpl('error', error=inst.message))
   231 
   231 
   232     def templater(self, req):
   232     def templater(self, req):
   233 
   233