comparison 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
comparison
equal deleted inserted replaced
5994:a445388aa554 5995:b913d3aacddc
21 #import os 21 #import os
22 #os.environ["HGENCODING"] = "UTF-8" 22 #os.environ["HGENCODING"] = "UTF-8"
23 23
24 from mercurial.hgweb.hgwebdir_mod import hgwebdir 24 from mercurial.hgweb.hgwebdir_mod import hgwebdir
25 from mercurial.hgweb.request import wsgiapplication 25 from mercurial.hgweb.request import wsgiapplication
26 from mercurial import dispatch, ui
26 from flup.server.fcgi import WSGIServer 27 from flup.server.fcgi import WSGIServer
27 28
28 # The config file looks like this. You can have paths to individual 29 # The config file looks like this. You can have paths to individual
29 # repos, collections of repos in a directory tree, or both. 30 # repos, collections of repos in a directory tree, or both.
30 # 31 #
42 # Then repos will list as bar and quux/baz. 43 # Then repos will list as bar and quux/baz.
43 # 44 #
44 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples 45 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
45 # or use a dictionary with entries like 'virtual/path': '/real/path' 46 # or use a dictionary with entries like 'virtual/path': '/real/path'
46 47
47 def make_web_app(): 48 def web_app(ui):
48 return hgwebdir("hgweb.config") 49 return lambda: hgwebdir("hgweb.config", ui)
49 50
50 WSGIServer(wsgiapplication(make_web_app)).run() 51 u = ui.ui(report_untrusted=False, interactive=False)
52 dispatch.profiled(u, lambda: WSGIServer(wsgiapplication(web_app(u))).run())