mercurial/hgweb/hgwebdir_mod.py
changeset 6796 943f066c0d58
parent 6785 4879468fa28f
child 6797 8909070fd05e
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Jun 29 22:36:18 2008 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Jul 02 12:02:33 2008 +0200
@@ -70,7 +70,8 @@
 
     def __call__(self, env, respond):
         req = wsgirequest(env, respond)
-        return self.run_wsgi(req)
+        self.run_wsgi(req)
+        return req
 
     def run_wsgi(self, req):
 
@@ -89,12 +90,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
 
@@ -105,7 +108,8 @@
                         req.env['REPO_NAME'] = virtual
                         try:
                             repo = hg.repository(self.parentui, real)
-                            return hgweb(repo).run_wsgi(req)
+                            hgweb(repo).run_wsgi(req)
+                            return
                         except IOError, inst:
                             msg = inst.strerror
                             raise ErrorResponse(HTTP_SERVER_ERROR, msg)
@@ -116,7 +120,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 +130,11 @@
 
                 # prefixes not found
                 req.respond(HTTP_NOT_FOUND, ctype)
-                return ''.join(tmpl("notfound", repo=virtual)),
+                req.write(tmpl("notfound", repo=virtual))
 
             except ErrorResponse, err:
                 req.respond(err.code, ctype)
-                return ''.join(tmpl('error', error=err.message or '')),
+                req.write(tmpl('error', error=err.message or ''))
         finally:
             tmpl = None