##// END OF EJS Templates
hgweb.cgi and hgwebdir.cgi fixes/cleanups for user configurable parts:...
Thomas Arendsen Hein -
r3868:6033d9f2 default
parent child Browse files
Show More
@@ -1,23 +1,28 b''
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 import cgitb, os, sys
5 # send python tracebacks to the browser if an error occurs:
6 import cgitb
6 cgitb.enable()
7 cgitb.enable()
7
8
8 # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
9 # adjust python path if not a system-wide install:
9 from mercurial.hgweb.hgweb_mod import hgweb
10 #import sys
10 from mercurial.hgweb.request import wsgiapplication
11 #sys.path.insert(0, "/path/to/python/lib")
11 import mercurial.hgweb.wsgicgi as wsgicgi
12
12
13 # If you'd like to serve pages with UTF-8 instead of your default
13 # 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.
14 # locale charset, you can do so by uncommenting the following lines.
15 # Note that this will cause your .hgrc files to be interpreted in
15 # 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.
16 # UTF-8 and all your repo files to be displayed using UTF-8.
17 #
17 #
18 # os.environ["HGENCODING"] = "UTF-8"
18 #import os
19 #os.environ["HGENCODING"] = "UTF-8"
20
21 from mercurial.hgweb.hgweb_mod import hgweb
22 from mercurial.hgweb.request import wsgiapplication
23 import mercurial.hgweb.wsgicgi as wsgicgi
19
24
20 def make_web_app():
25 def make_web_app():
21 return hgweb("/path/to/repo", "repository name")
26 return hgweb("/path/to/repo", "repository name")
22
27
23 wsgicgi.launch(wsgiapplication(make_web_app))
28 wsgicgi.launch(wsgiapplication(make_web_app))
@@ -1,42 +1,47 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 import cgitb, sys
5 # send python tracebacks to the browser if an error occurs:
6 import cgitb
6 cgitb.enable()
7 cgitb.enable()
7
8
8 # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
9 # adjust python path if not a system-wide install:
10 #import sys
11 #sys.path.insert(0, "/path/to/python/lib")
12
13 # 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.
15 # 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.
17 #
18 #import os
19 #os.environ["HGENCODING"] = "UTF-8"
20
9 from mercurial.hgweb.hgwebdir_mod import hgwebdir
21 from mercurial.hgweb.hgwebdir_mod import hgwebdir
10 from mercurial.hgweb.request import wsgiapplication
22 from mercurial.hgweb.request import wsgiapplication
11 import mercurial.hgweb.wsgicgi as wsgicgi
23 import mercurial.hgweb.wsgicgi as wsgicgi
12
24
13 # The config file looks like this. You can have paths to individual
25 # The config file looks like this. You can have paths to individual
14 # repos, collections of repos in a directory tree, or both.
26 # repos, collections of repos in a directory tree, or both.
15 #
27 #
16 # [paths]
28 # [paths]
17 # virtual/path = /real/path
29 # virtual/path = /real/path
18 # virtual/path = /real/path
30 # virtual/path = /real/path
19 #
31 #
20 # [collections]
32 # [collections]
21 # /prefix/to/strip/off = /root/of/tree/full/of/repos
33 # /prefix/to/strip/off = /root/of/tree/full/of/repos
22 #
34 #
23 # collections example: say directory tree /foo contains repos /foo/bar,
35 # collections example: say directory tree /foo contains repos /foo/bar,
24 # /foo/quux/baz. Give this config section:
36 # /foo/quux/baz. Give this config section:
25 # [collections]
37 # [collections]
26 # /foo = /foo
38 # /foo = /foo
27 # Then repos will list as bar and quux/baz.
39 # Then repos will list as bar and quux/baz.
28
40 #
29 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
41 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
30 # or use a dictionary with entries like 'virtual/path': '/real/path'
42 # or use a dictionary with entries like 'virtual/path': '/real/path'
31
43
32 # If you'd like to serve pages with UTF-8 instead of your default
33 # locale charset, you can do so by uncommenting the following lines.
34 # Note that this will cause your .hgrc files to be interpreted in
35 # UTF-8 and all your repo files to be displayed using UTF-8.
36 #
37 # os.environ["HGENCODING"] = "UTF-8"
38
39 def make_web_app():
44 def make_web_app():
40 return hgwebdir("hgweb.config")
45 return hgwebdir("hgweb.config")
41
46
42 wsgicgi.launch(wsgiapplication(make_web_app))
47 wsgicgi.launch(wsgiapplication(make_web_app))
General Comments 0
You need to be logged in to leave comments. Login now