diff contrib/hgwebdir.fcgi @ 5995:b913d3aacddc

profiling: allow CGI and FastCGI to be profiled
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 01 Feb 2008 13:09:45 -0800
parents 79279b5583c6
children e1f11b8a1e9e 90e5c82a3859
line wrap: on
line diff
--- a/contrib/hgwebdir.fcgi	Fri Feb 01 10:31:15 2008 +0100
+++ b/contrib/hgwebdir.fcgi	Fri Feb 01 13:09:45 2008 -0800
@@ -23,6 +23,7 @@
 
 from mercurial.hgweb.hgwebdir_mod import hgwebdir
 from mercurial.hgweb.request import wsgiapplication
+from mercurial import dispatch, ui
 from flup.server.fcgi import WSGIServer
 
 # The config file looks like this.  You can have paths to individual
@@ -44,7 +45,8 @@
 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
 # or use a dictionary with entries like 'virtual/path': '/real/path'
 
-def make_web_app():
-    return hgwebdir("hgweb.config")
+def web_app(ui):
+    return lambda: hgwebdir("hgweb.config", ui)
 
-WSGIServer(wsgiapplication(make_web_app)).run()
+u = ui.ui(report_untrusted=False, interactive=False)
+dispatch.profiled(u, lambda: WSGIServer(wsgiapplication(web_app(u))).run())