~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/server/moinmodpy.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 
8
8
    <Files wiki>
9
9
      SetHandler python-program
10
 
      PythonPath "['/path/to/moin/share/moin/cgi-bin'] + sys.path"
 
10
      PythonPath "['/path/to/share/moin/server'] + sys.path"
11
11
      PythonHandler moinmodpy
12
12
    </Files>
13
13
 
22
22
    look into INSTALL.html to see how you can fix the bug on your own
23
23
    (a simple one line change).
24
24
 
25
 
 
26
25
    @copyright: 2004-2005 by Oliver Graf <ograf@bitart.de>
27
26
    @license: GNU GPL, see COPYING for details.
28
27
"""
29
28
 
30
 
# System path configuration
31
 
 
32
 
import sys
33
 
 
34
 
# Path to MoinMoin package, needed if you installed with --prefix=PREFIX
35
 
# or if you did not use setup.py.
36
 
## sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
37
 
 
38
 
# Path of the directory where wikiconfig.py is located.
39
 
# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
40
 
sys.path.insert(0, '/path/to/wikiconfig')
41
 
 
42
 
# Path of the directory where farmconfig is located (if different).
43
 
## sys.path.insert(0, '/path/to/farmconfig')
 
29
import sys, os
 
30
 
 
31
# a) Configuration of Python's code search path
 
32
#    If you already have set up the PYTHONPATH environment variable for the
 
33
#    stuff you see below, you don't need to do a1) and a2).
 
34
 
 
35
# a1) Path of the directory where the MoinMoin code package is located.
 
36
#     Needed if you installed with --prefix=PREFIX or you didn't use setup.py.
 
37
#sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
 
38
 
 
39
# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
 
40
#     See wiki/config/... for some sample config files.
 
41
#sys.path.insert(0, '/path/to/wikiconfigdir')
 
42
#sys.path.insert(0, '/path/to/farmconfigdir')
 
43
 
 
44
# b) Configuration of moin's logging
 
45
#    If you have set up MOINLOGGINGCONF environment variable, you don't need this!
 
46
#    You also don't need this if you are happy with the builtin defaults.
 
47
#    See wiki/config/logging/... for some sample config files.
 
48
#from MoinMoin import log
 
49
#log.load_config('/path/to/logging_configuration_file')
44
50
 
45
51
# Debug mode - show detailed error reports
46
 
## import os
47
 
## os.environ['MOIN_DEBUG'] = '1'
48
 
 
49
 
# Set threads flag, so other code can use proper locking.
50
 
# TODO: It seems that modpy does not use threads, so we don't need to
51
 
# set it here. Do we have another method to check this?
52
 
from MoinMoin import config
53
 
config.use_threads = 1
54
 
del config
55
 
 
56
 
 
57
 
from MoinMoin.request import RequestModPy
 
52
#os.environ['MOIN_DEBUG'] = '1'
 
53
 
 
54
 
 
55
from MoinMoin.server.server_modpython import ModpythonConfig, modpythonHandler
 
56
 
 
57
class MyConfig(ModpythonConfig):
 
58
    """ Set up local server-specific stuff here """
 
59
    # Properties
 
60
    # Allow overriding any request property by the value defined in
 
61
    # this dict e.g properties = {'script_name': '/mywiki'}.
 
62
    ## properties = {}
58
63
 
59
64
def handler(request):
60
 
    moinreq = RequestModPy(request)
61
 
    return moinreq.run(request)
 
65
    return modpythonHandler(request, MyConfig)
62
66