diff mercurial/hgweb/hgweb_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 feac5b0bf9ba
children 9c7f543405c1 e15f7db0f0ee
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Wed Nov 28 13:58:31 2007 -0800
+++ b/mercurial/hgweb/hgweb_mod.py	Fri Nov 30 18:23:18 2007 +0100
@@ -13,6 +13,7 @@
 from mercurial import mdiff, ui, hg, util, archival, streamclone, patch
 from mercurial import revlog, templater
 from common import ErrorResponse, get_mtime, staticfile, style_map, paritygen
+from request import wsgirequest
 
 def _up(p):
     if p[0] != "/":
@@ -671,10 +672,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):