Mercurial > hg
changeset 6797:8909070fd05e
merge another backout
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Wed, 02 Jul 2008 12:27:57 +0200 |
parents | c228ae4bc89c (current diff) 943f066c0d58 (diff) |
children | ceb28b67204e |
files | mercurial/hgweb/hgweb_mod.py mercurial/hgweb/hgwebdir_mod.py |
diffstat | 6 files changed, 35 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Wed Jul 02 11:31:19 2008 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Wed Jul 02 12:27:57 2008 +0200 @@ -169,20 +169,23 @@ req.write(content) del tmpl - return ''.join(content), + return [] except revlog.LookupError, err: req.respond(HTTP_NOT_FOUND, ctype) msg = str(err) if 'manifest' not in msg: msg = 'revision not found: %s' % err.name - return ''.join(tmpl('error', error=msg)), + req.write(tmpl('error', error=msg)) + return [] except (RepoError, revlog.RevlogError), inst: req.respond(HTTP_SERVER_ERROR, ctype) - return ''.join(tmpl('error', error=str(inst))), + req.write(tmpl('error', error=str(inst))) + return [] except ErrorResponse, inst: req.respond(inst.code, ctype) - return ''.join(tmpl('error', error=inst.message)), + req.write(tmpl('error', error=inst.message)) + return [] def templater(self, req):
--- a/mercurial/hgweb/hgwebdir_mod.py Wed Jul 02 11:31:19 2008 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Wed Jul 02 12:27:57 2008 +0200 @@ -89,12 +89,14 @@ fname = virtual[7:] else: fname = req.form['static'][0] - return staticfile(static, fname, req), + req.write(staticfile(static, fname, req)) + return [] # top-level index elif not virtual: req.respond(HTTP_OK, ctype) - return ''.join(self.makeindex(req, tmpl)), + req.write(self.makeindex(req, tmpl)) + return [] # nested indexes and hgwebs @@ -116,7 +118,8 @@ subdir = virtual + '/' if [r for r in repos if r.startswith(subdir)]: req.respond(HTTP_OK, ctype) - return ''.join(self.makeindex(req, tmpl, subdir)), + req.write(self.makeindex(req, tmpl, subdir)) + return [] up = virtual.rfind('/') if up < 0: @@ -125,11 +128,13 @@ # prefixes not found req.respond(HTTP_NOT_FOUND, ctype) - return ''.join(tmpl("notfound", repo=virtual)), + req.write(tmpl("notfound", repo=virtual)) + return [] except ErrorResponse, err: req.respond(err.code, ctype) - return ''.join(tmpl('error', error=err.message or '')), + req.write(tmpl('error', error=err.message or '')) + return [] finally: tmpl = None
--- a/tests/test-hgweb-no-path-info Wed Jul 02 11:31:19 2008 +0200 +++ b/tests/test-hgweb-no-path-info Wed Jul 02 12:27:57 2008 +0200 @@ -43,17 +43,15 @@ output = StringIO() env['QUERY_STRING'] = 'style=atom' -content = hgweb('.', name = 'repo')(env, startrsp) -sys.stdout.write(output.getvalue()) -sys.stdout.write(''.join(content)) +hgweb('.', name = 'repo')(env, startrsp) +print output.getvalue() print '---- ERRORS' print errors.getvalue() output = StringIO() env['QUERY_STRING'] = 'style=raw' -content = hgwebdir({'repo': '.'})(env, startrsp) -sys.stdout.write(output.getvalue()) -sys.stdout.write(''.join(content)) +hgwebdir({'repo': '.'})(env, startrsp) +print output.getvalue() print '---- ERRORS' print errors.getvalue() EOF
--- a/tests/test-hgweb-no-path-info.out Wed Jul 02 11:31:19 2008 +0200 +++ b/tests/test-hgweb-no-path-info.out Wed Jul 02 12:27:57 2008 +0200 @@ -35,6 +35,7 @@ </entry> </feed> + ---- ERRORS ---- HEADERS @@ -44,5 +45,6 @@ repo/ + ---- ERRORS
--- a/tests/test-hgweb-no-request-uri Wed Jul 02 11:31:19 2008 +0200 +++ b/tests/test-hgweb-no-request-uri Wed Jul 02 12:27:57 2008 +0200 @@ -44,36 +44,32 @@ output = StringIO() env['PATH_INFO'] = '/' env['QUERY_STRING'] = 'style=atom' -content = hgweb('.', name = 'repo')(env, startrsp) -sys.stdout.write(output.getvalue()) -sys.stdout.write(''.join(content)) +hgweb('.', name = 'repo')(env, startrsp) +print output.getvalue() print '---- ERRORS' print errors.getvalue() output = StringIO() env['PATH_INFO'] = '/file/tip/' env['QUERY_STRING'] = 'style=raw' -content = hgweb('.', name = 'repo')(env, startrsp) -sys.stdout.write(output.getvalue()) -sys.stdout.write(''.join(content)) +hgweb('.', name = 'repo')(env, startrsp) +print output.getvalue() print '---- ERRORS' print errors.getvalue() output = StringIO() env['PATH_INFO'] = '/' env['QUERY_STRING'] = 'style=raw' -content = hgwebdir({'repo': '.'})(env, startrsp) -sys.stdout.write(output.getvalue()) -sys.stdout.write(''.join(content)) +hgwebdir({'repo': '.'})(env, startrsp) +print output.getvalue() print '---- ERRORS' print errors.getvalue() output = StringIO() env['PATH_INFO'] = '/repo/file/tip/' env['QUERY_STRING'] = 'style=raw' -content = hgwebdir({'repo': '.'})(env, startrsp) -sys.stdout.write(output.getvalue()) -sys.stdout.write(''.join(content)) +hgwebdir({'repo': '.'})(env, startrsp) +print output.getvalue() print '---- ERRORS' print errors.getvalue() EOF
--- a/tests/test-hgweb-no-request-uri.out Wed Jul 02 11:31:19 2008 +0200 +++ b/tests/test-hgweb-no-request-uri.out Wed Jul 02 12:27:57 2008 +0200 @@ -35,6 +35,7 @@ </entry> </feed> + ---- ERRORS ---- HEADERS @@ -45,6 +46,7 @@ -rw-r--r-- 4 bar + ---- ERRORS ---- HEADERS @@ -54,6 +56,7 @@ /repo/ + ---- ERRORS ---- HEADERS @@ -64,5 +67,6 @@ -rw-r--r-- 4 bar + ---- ERRORS