comparison hgweb.cgi @ 6042:2da5b19a6460

Merge with crew
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 06 Feb 2008 19:57:52 -0800
parents b913d3aacddc
children 4baad19c4801 90e5c82a3859
comparison
equal deleted inserted replaced
6041:dd714452c26e 6042:2da5b19a6460
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # An example CGI script to use hgweb, edit as necessary 3 # An example CGI script to use hgweb, edit as necessary
4 4
5 # adjust python path if not a system-wide install:
6 #import sys
7 #sys.path.insert(0, "/path/to/python/lib")
8
9 # enable importing on demand to reduce startup time
10 from mercurial import demandimport; demandimport.enable()
11
5 # send python tracebacks to the browser if an error occurs: 12 # send python tracebacks to the browser if an error occurs:
6 import cgitb 13 import cgitb
7 cgitb.enable() 14 cgitb.enable()
8
9 # adjust python path if not a system-wide install:
10 #import sys
11 #sys.path.insert(0, "/path/to/python/lib")
12 15
13 # If you'd like to serve pages with UTF-8 instead of your default 16 # If you'd like to serve pages with UTF-8 instead of your default
14 # locale charset, you can do so by uncommenting the following lines. 17 # locale charset, you can do so by uncommenting the following lines.
15 # Note that this will cause your .hgrc files to be interpreted in 18 # Note that this will cause your .hgrc files to be interpreted in
16 # UTF-8 and all your repo files to be displayed using UTF-8. 19 # UTF-8 and all your repo files to be displayed using UTF-8.
17 # 20 #
18 #import os 21 #import os
19 #os.environ["HGENCODING"] = "UTF-8" 22 #os.environ["HGENCODING"] = "UTF-8"
20 23
21 from mercurial.hgweb.hgweb_mod import hgweb 24 from mercurial.hgweb.hgweb_mod import hgweb
22 from mercurial.hgweb.request import wsgiapplication 25 from mercurial import dispatch, ui
23 import mercurial.hgweb.wsgicgi as wsgicgi 26 import mercurial.hgweb.wsgicgi as wsgicgi
24 27
25 def make_web_app(): 28 u = ui.ui(report_untrusted=False, interactive=False)
26 return hgweb("/path/to/repo", "repository name") 29 dispatch.profiled(u, lambda: wsgicgi.launch(hgweb("/path/to/repo",
27 30 "repository name", u)))
28 wsgicgi.launch(wsgiapplication(make_web_app))