##// END OF EJS Templates
hgweb: disable cgitb by default in hgwebdir.fcgi too
Maxim Dounin -
r6085:e1f11b8a default
parent child Browse files
Show More
@@ -1,52 +1,52 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # An example CGI script to export multiple hgweb repos, edit as necessary
3 # An example CGI script to export multiple hgweb repos, edit as necessary
4
4
5 # adjust python path if not a system-wide install:
5 # adjust python path if not a system-wide install:
6 #import sys
6 #import sys
7 #sys.path.insert(0, "/path/to/python/lib")
7 #sys.path.insert(0, "/path/to/python/lib")
8
8
9 # enable demandloading to reduce startup time
9 # enable demandloading to reduce startup time
10 from mercurial import demandimport; demandimport.enable()
10 from mercurial import demandimport; demandimport.enable()
11
11
12 # send python tracebacks to the browser if an error occurs:
12 # Uncomment to send python tracebacks to the browser if an error occurs:
13 import cgitb
13 #import cgitb
14 cgitb.enable()
14 #cgitb.enable()
15
15
16 # 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
17 # locale charset, you can do so by uncommenting the following lines.
17 # locale charset, you can do so by uncommenting the following lines.
18 # 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
19 # 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.
20 #
20 #
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 mercurial import dispatch, ui
27 from flup.server.fcgi import WSGIServer
27 from flup.server.fcgi import WSGIServer
28
28
29 # 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
30 # repos, collections of repos in a directory tree, or both.
30 # repos, collections of repos in a directory tree, or both.
31 #
31 #
32 # [paths]
32 # [paths]
33 # virtual/path = /real/path
33 # virtual/path = /real/path
34 # virtual/path = /real/path
34 # virtual/path = /real/path
35 #
35 #
36 # [collections]
36 # [collections]
37 # /prefix/to/strip/off = /root/of/tree/full/of/repos
37 # /prefix/to/strip/off = /root/of/tree/full/of/repos
38 #
38 #
39 # collections example: say directory tree /foo contains repos /foo/bar,
39 # collections example: say directory tree /foo contains repos /foo/bar,
40 # /foo/quux/baz. Give this config section:
40 # /foo/quux/baz. Give this config section:
41 # [collections]
41 # [collections]
42 # /foo = /foo
42 # /foo = /foo
43 # Then repos will list as bar and quux/baz.
43 # Then repos will list as bar and quux/baz.
44 #
44 #
45 # 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
46 # or use a dictionary with entries like 'virtual/path': '/real/path'
46 # or use a dictionary with entries like 'virtual/path': '/real/path'
47
47
48 def web_app(ui):
48 def web_app(ui):
49 return lambda: hgwebdir("hgweb.config", ui)
49 return lambda: hgwebdir("hgweb.config", ui)
50
50
51 u = ui.ui(report_untrusted=False, interactive=False)
51 u = ui.ui(report_untrusted=False, interactive=False)
52 dispatch.profiled(u, lambda: WSGIServer(wsgiapplication(web_app(u))).run())
52 dispatch.profiled(u, lambda: WSGIServer(wsgiapplication(web_app(u))).run())
General Comments 0
You need to be logged in to leave comments. Login now