Mercurial > hg
comparison hgweb.cgi @ 11000:338167735124
hgweb: simplify hgweb.cgi, add help pointer
- move important config to the top
- add help pointer
- drop encoding hack comment (use web.encoding)
- simplify imports
- use unified hgweb interface
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 26 Apr 2010 11:03:40 -0500 |
parents | 50a277e6ceae |
children | 227b9f13db13 |
comparison
equal
deleted
inserted
replaced
10999:38182ed043b7 | 11000:338167735124 |
---|---|
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 hgweb CGI script, edit as necessary |
4 | 4 |
5 # adjust python path if not a system-wide install: | 5 # Path to repo or hgweb config to serve (see 'hg help hgweb') |
6 #import sys | 6 config = "/path/to/repo/or/config" |
7 #sys.path.insert(0, "/path/to/python/lib") | |
8 | 7 |
9 # enable importing on demand to reduce startup time | 8 # Uncomment and adjust if Mercurial is not installed system-wide: |
10 from mercurial import demandimport; demandimport.enable() | 9 #import sys; sys.path.insert(0, "/path/to/python/lib") |
11 | 10 |
12 # Uncomment to send python tracebacks to the browser if an error occurs: | 11 # Uncomment to send python tracebacks to the browser if an error occurs: |
13 #import cgitb | 12 #import cgitb; cgitb.enable() |
14 #cgitb.enable() | |
15 | 13 |
16 # If you'd like to serve pages with UTF-8 instead of your default | 14 from mercurial import demandimport; demandimport.enable() |
17 # locale charset, you can do so by uncommenting the following lines. | 15 from mercurial.hgweb import hgweb, wsgicgi |
18 # Note that this will cause your .hgrc files to be interpreted in | 16 application = hgweb(config) |
19 # UTF-8 and all your repo files to be displayed using UTF-8. | |
20 # | |
21 #import os | |
22 #os.environ["HGENCODING"] = "UTF-8" | |
23 | |
24 from mercurial.hgweb.hgweb_mod import hgweb | |
25 import mercurial.hgweb.wsgicgi as wsgicgi | |
26 | |
27 application = hgweb("/path/to/repo", "repository name") | |
28 wsgicgi.launch(application) | 17 wsgicgi.launch(application) |