diff mercurial/hgweb/hgweb_mod.py @ 5964:1cd1582ef25f

hgweb: centralize req.write() calls
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 28 Jan 2008 15:10:17 +0100
parents 5be210afe1b8
children 9f1e6ab76069
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Mon Jan 28 14:58:03 2008 +0100
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Jan 28 15:10:17 2008 +0100
@@ -214,18 +214,18 @@
                 if cmd not in webcommands.__all__:
                     raise ErrorResponse(400, 'No such method: ' + cmd)
                 elif cmd == 'file' and 'raw' in req.form.get('style', []):
-                    webcommands.rawfile(self, req, tmpl)
+                    content = webcommands.rawfile(self, req, tmpl)
                 else:
-                    getattr(webcommands, cmd)(self, req, tmpl)
+                    content = getattr(webcommands, cmd)(self, req, tmpl)
 
+                req.write(content)
                 del tmpl
 
         except revlog.LookupError, err:
             req.respond(404, tmpl(
                         'error', error='revision not found: %s' % err.name))
         except (hg.RepoError, revlog.RevlogError), inst:
-            req.respond('500 Internal Server Error',
-                        tmpl('error', error=str(inst)))
+            req.respond(500, tmpl('error', error=str(inst)))
         except ErrorResponse, inst:
             req.respond(inst.code, tmpl('error', error=inst.message))