Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/hgweb_mod.py @ 6784:18c429ea3a0e
hgweb: all protocol functions have become generators
Using the write() callable supplied by the start_response() call is
frowned upon by the WSGI spec, returning an iterable over the content chunks
is the recommended way. Be aware, though: returning many small chunks will
slow down responses, because the server has to flush each chunk separately.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 29 Jun 2008 15:23:09 +0200 |
parents | b4b7261164d5 |
children | 4879468fa28f |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sun Jun 29 13:16:25 2008 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Sun Jun 29 15:23:09 2008 +0200 @@ -76,8 +76,7 @@ def __call__(self, env, respond): req = wsgirequest(env, respond) - self.run_wsgi(req) - return req + return self.run_wsgi(req) def run_wsgi(self, req): @@ -90,10 +89,9 @@ cmd = req.form.get('cmd', [''])[0] if cmd and cmd in protocol.__all__: if cmd in perms and not self.check_perm(req, perms[cmd]): - return + return [] method = getattr(protocol, cmd) - method(self.repo, req) - return + return method(self.repo, req) # work with CGI variables to create coherent structure # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME @@ -171,6 +169,7 @@ req.write(content) del tmpl + return req except revlog.LookupError, err: req.respond(HTTP_NOT_FOUND, ctype)