diff mercurial/hgweb/hgwebdir_mod.py @ 5566:d74fc8dec2b4

Less indirection in the WSGI web interface. This simplifies some code, and makes it more compliant with WSGI.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 30 Nov 2007 18:23:18 +0100
parents 22713dce19f6
children e15f7db0f0ee
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Nov 28 13:58:31 2007 -0800
+++ b/mercurial/hgweb/hgwebdir_mod.py	Fri Nov 30 18:23:18 2007 +0100
@@ -11,6 +11,7 @@
 from mercurial import ui, hg, util, templater
 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen
 from hgweb_mod import hgweb
+from request import wsgirequest
 
 # This is a stopgap
 class hgwebdir(object):
@@ -60,10 +61,12 @@
         if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
             raise RuntimeError("This function is only intended to be called while running as a CGI script.")
         import mercurial.hgweb.wsgicgi as wsgicgi
-        from request import wsgiapplication
-        def make_web_app():
-            return self
-        wsgicgi.launch(wsgiapplication(make_web_app))
+        wsgicgi.launch(self)
+
+    def __call__(self, env, respond):
+        req = wsgirequest(env, respond)
+        self.run_wsgi(req)
+        return req
 
     def run_wsgi(self, req):
         def header(**map):