~ubuntu-branches/ubuntu/feisty/pyblosxom/feisty

« back to all changes in this revision

Viewing changes to web/pyblosxom.cgi

  • Committer: Bazaar Package Importer
  • Author(s): Charles Majola
  • Date: 2005-02-21 14:38:10 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050221143810-c1r07ibzr5hr863u
Tags: 1.0.0-2ubuntu1
* Rebuild for python2.4
* Fixed patches also 2.3 -> 2.4 
* Standards Version 3.6.1.1 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
"""pyblosxom
 
3
A Bloxsom clone in python, see http://www.raelity.org/apps/blosxom/ for 
 
4
Blosxom details.
 
5
"""
 
6
# Uncomment this if something goes wrong (for debugging)
 
7
#import cgitb; cgitb.enable()
 
8
 
 
9
# Settings are now in config.py, you should disable access to it by htaccess
 
10
# (make it executable or deny access)
 
11
import config
 
12
 
 
13
# If the user defined a "codebase" property in their config file,
 
14
# then we insert that into our sys.path because that's where the
 
15
# PyBlosxom installation is.
 
16
if config.py.has_key("codebase"):
 
17
    import sys
 
18
    sys.path.insert(0, config.py["codebase"])
 
19
 
 
20
__author__ = 'Wari Wahab <wari@wari.per.sg>'
 
21
__version__ = config.py['pyblosxom_version']
 
22
__date__ = "$Date: 2004/05/04 20:53:48 $"
 
23
__revision__ = "$Revision: 1.7 $"
 
24
__copyright__ = "Copyright (c) 2003-2004 Wari Wahab"
 
25
__license__ = "Python"
 
26
 
 
27
if __name__ == '__main__':
 
28
    from Pyblosxom.pyblosxom import Request, test_installation, PyBlosxom
 
29
    import os, sys
 
30
 
 
31
    req = Request()
 
32
    req.addConfiguration(config.py)
 
33
 
 
34
    d = {}
 
35
    for mem in ["HTTP_HOST", "HTTP_USER_AGENT", "HTTP_REFERER", "PATH_INFO", 
 
36
            "QUERY_STRING", "REMOTE_ADDR", "REQUEST_METHOD", "REQUEST_URI", 
 
37
            "SCRIPT_NAME", "HTTP_IF_NONE_MATCH", "HTTP_IF_MODIFIED_SINCE"]:
 
38
        d[mem] = os.environ.get(mem, "")
 
39
    req.addHttp(d)
 
40
 
 
41
    if not os.environ.get("REQUEST_METHOD", ""):
 
42
        if len(sys.argv) > 1 and sys.argv[1] == "--static":
 
43
            if "--incremental" in sys.argv:
 
44
                incremental = 1
 
45
            else:
 
46
                incremental = 0
 
47
            p = PyBlosxom(req)
 
48
            p.runStaticRenderer(incremental)
 
49
        else:
 
50
            test_installation(req)
 
51
 
 
52
    else:
 
53
        p = PyBlosxom(req)
 
54
        p.run()
 
55
 
 
56
# vim: shiftwidth=4 tabstop=4 expandtab