java/hg-projekty/web/WEB-INF/cgi/hgweb.cgi
author František Kučera <franta-hg@frantovo.cz>
Mon Feb 16 18:59:16 2009 +0100 (2009-02-16)
changeset 1 4bec1ea05529
permissions -rw-r--r--
Funkční CGI servlet. Adresa: http://hg.frantovo.cz/cgi-bin/hgweb.cgi – adresu je potřeba vylepšit!
franta-hg@1
     1
#!/usr/bin/env python
franta-hg@1
     2
#
franta-hg@1
     3
# An example CGI script to use hgweb, edit as necessary
franta-hg@1
     4
franta-hg@1
     5
# adjust python path if not a system-wide install:
franta-hg@1
     6
#import sys
franta-hg@1
     7
#sys.path.insert(0, "/path/to/python/lib")
franta-hg@1
     8
franta-hg@1
     9
# enable importing on demand to reduce startup time
franta-hg@1
    10
from mercurial import demandimport; demandimport.enable()
franta-hg@1
    11
franta-hg@1
    12
# Uncomment to send python tracebacks to the browser if an error occurs:
franta-hg@1
    13
import cgitb
franta-hg@1
    14
cgitb.enable()
franta-hg@1
    15
franta-hg@1
    16
# If you'd like to serve pages with UTF-8 instead of your default
franta-hg@1
    17
# locale charset, you can do so by uncommenting the following lines.
franta-hg@1
    18
# Note that this will cause your .hgrc files to be interpreted in
franta-hg@1
    19
# UTF-8 and all your repo files to be displayed using UTF-8.
franta-hg@1
    20
#
franta-hg@1
    21
import os
franta-hg@1
    22
os.environ["HGENCODING"] = "UTF-8"
franta-hg@1
    23
franta-hg@1
    24
from mercurial.hgweb.hgweb_mod import hgweb
franta-hg@1
    25
import mercurial.hgweb.wsgicgi as wsgicgi
franta-hg@1
    26
franta-hg@1
    27
application = hgweb("/var/hg/projekty/pokus", "Pokus")
franta-hg@1
    28
wsgicgi.launch(application)