annotate wiki/server/moinmodpy.py @ 3071:806cf4814612

get server/request package in sync with 1.6 branch (as of changeset 2559:eedcb9cfefdb)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 22 Feb 2008 21:59:32 +0100
parents ea78a739b5ad
children 80e1a910a2f1
rev   line source
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
2 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
3 MoinMoin - mod_python wrapper for broken mod_python versions
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
5 add a .htaccess to the path below which you want to have your
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
6 wiki instance:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
7
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
8 <Files wiki>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
9 SetHandler python-program
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
10 PythonPath "['/path/to/moin/share/moin/cgi-bin'] + sys.path"
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
11 PythonHandler moinmodpy
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
12 </Files>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
14 Note: this is a wrapper needed because of a bug in
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
15 mod_python < 3.1.3
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
16
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
17
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
18 mod_python.apache.resolve_object fails to parse a object with dots.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
19
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
20 If you have a newer version, take a look at moinmodpy.htaccess
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
21 to see how to use MoinMoin without this wrapper. You can also
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
22 look into INSTALL.html to see how you can fix the bug on your own
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
23 (a simple one line change).
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
24
1946
412b50bb3740 add some MoinMoin.server refactoring TODOs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 654
diff changeset
25 TODO: this should be refactored so it uses MoinMoin.server package
3071
806cf4814612 get server/request package in sync with 1.6 branch (as of changeset 2559:eedcb9cfefdb)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2975
diff changeset
26 (see how server_twisted, server_wsgi and server_standalone use it)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
27
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
28 @copyright: 2004-2005 by Oliver Graf <ograf@bitart.de>
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
29 @license: GNU GPL, see COPYING for details.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
30 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
31
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
32 # System path configuration
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
33
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
34 import sys
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
35
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
36 # Path of the directory where wikiconfig.py is located.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
37 # YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
38 sys.path.insert(0, '/path/to/wikiconfig')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
39
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
40 # Path to MoinMoin package, needed if you installed with --prefix=PREFIX
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
41 # or if you did not use setup.py.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
42 ## sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
43
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
44 # Path of the directory where farmconfig is located (if different).
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
45 ## sys.path.insert(0, '/path/to/farmconfig')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
46
49
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 0
diff changeset
47 # Debug mode - show detailed error reports
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 0
diff changeset
48 ## import os
cf52f97a5857 merge moin--main--1.3--patch-928
Nir Soffer <nirs@freeshell.org>
parents: 0
diff changeset
49 ## os.environ['MOIN_DEBUG'] = '1'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
50
2975
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
51 # Simple way
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
52 #from MoinMoin.server.server_modpython import modpythonHandler as handler
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
53
2975
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
54 # Complex way
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
55 from MoinMoin.server.server_modpython import ModpythonConfig, modpythonHandler
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
56
2975
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
57 class MyConfig(ModpythonConfig):
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
58 """ Set up local server-specific stuff here """
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
59
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
60 # Make sure moin will have permission to write to this file!
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
61 # Otherwise it will cause a server error.
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
62 logPath = "/var/log/apache2/moinlog"
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
63
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
64 # Properties
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
65 # Allow overriding any request property by the value defined in
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
66 # this dict e.g properties = {'script_name': '/mywiki'}.
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
67 ## properties = {}
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
68
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
69 def handler(request):
2975
ea78a739b5ad imported patch fix-modpython-patch (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
70 return modpythonHandler(request, MyConfig)