view wiki/server/moinmodpy.py @ 49:cf52f97a5857

merge moin--main--1.3--patch-928 Patches applied: * arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-928 Fix error handling on failure, improved error display * nirs@freeshell.org--2005/moin--fix--1.3--patch-28 integrate new cgitb error handling * nirs@freeshell.org--2005/moin--fix--1.3--patch-29 huge merge from main, fixing strange conflicts in error.py and request.py * nirs@freeshell.org--2005/moin--fix--1.3--patch-30 cgitb refactoring * nirs@freeshell.org--2005/moin--fix--1.3--patch-31 fixed cgitb import * nirs@freeshell.org--2005/moin--fix--1.3--patch-32 merge from main * nirs@freeshell.org--2005/moin--fix--1.3--patch-33 adding MOIN_DEBUG to server scripts * nirs@freeshell.org--2005/moin--fix--1.3--patch-34 refacrot cgitb for eaiser customisation, use one view class in error with new simpler design, better error handling in multiconfig. * nirs@freeshell.org--2005/moin--fix--1.3--patch-35 merge from main * nirs@freeshell.org--2005/moin--fix--1.3--patch-36 Print simple text exception when cgitb fail from any reason * nirs@freeshell.org--2005/moin--fix--1.3--patch-37 remove changes not related to error handling * nirs@freeshell.org--2005/moin--fix--1.3--patch-38 raise more helpful error when there is no wikis list in farmconfig.py * nirs@freeshell.org--2005/moin--fix--1.3--patch-39 refactor getConfig, remove duplicate code, more correct error handling, use either farmconfig or wikiconfig mtime * nirs@freeshell.org--2005/moin--fix--1.3--patch-40 more clear error message when data or underlay missing or have wrong privilages * nirs@freeshell.org--2005/moin--fix--1.3--patch-41 update cgitb docstring * nirs@freeshell.org--2005/moin--fix--1.3--patch-42 make cgitb easiter to customize, simplify error.ErrorView, print cgitb traceback after the original traceback. * nirs@freeshell.org--2005/moin--fix--1.3--patch-43 refactoring multiconfig, make return values more clear, improving docstrings * nirs@freeshell.org--2005/moin--fix--1.3--patch-44 use only preformatted text in printException * nirs@freeshell.org--2005/moin--fix--1.3--patch-45 cgitb: improve code readability * nirs@freeshell.org--2005/moin--fix--1.3--patch-46 merge from main * nirs@freeshell.org--2005/moin--fix--1.3--patch-47 simplify the simple text traceback output * nirs@freeshell.org--2005/moin--fix--1.3--patch-48 moved failure handling to new failure module (save imports for cgi) * nirs@freeshell.org--2005/moin--fix--1.3--patch-49 spelling, docstring cleanup imported from: moin--main--1.5--patch-50
author Nir Soffer <nirs@freeshell.org>
date Thu, 29 Sep 2005 00:07:04 +0000
parents 77665d8e2254
children 8ed1a953d12e
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - mod_python wrapper for broken mod_python versions

    add a .htaccess to the path below which you want to have your
    wiki instance:

    <Files wiki>
      SetHandler python-program
      PythonPath "['/path/to/moin/share/moin/cgi-bin'] + sys.path"
      PythonHandler moinmodpy
    </Files>

    Note: this is a wrapper needed because of a bug in
          mod_python < 3.1.3


    mod_python.apache.resolve_object fails to parse a object with dots.

    If you have a newer version, take a look at moinmodpy.htaccess
    to see how to use MoinMoin without this wrapper. You can also
    look into INSTALL.html to see how you can fix the bug on your own
    (a simple one line change).


    @copyright: 2004-2005 by Oliver Graf <ograf@bitart.de>
    @license: GNU GPL, see COPYING for details.
"""

# System path configuration

import sys

# Path of the directory where wikiconfig.py is located.
# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
sys.path.insert(0, '/path/to/wikiconfig')

# Path to MoinMoin package, needed if you installed with --prefix=PREFIX
# or if you did not use setup.py.
## sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')

# Path of the directory where farmconfig is located (if different).
## sys.path.insert(0, '/path/to/farmconfig')

# Debug mode - show detailed error reports
## import os
## os.environ['MOIN_DEBUG'] = '1'

# Set threads flag, so other code can use proper locking.
# TODO: It seems that modpy does not use threads, so we don't need to
# set it here. Do we have another method to check this?
from MoinMoin import config
config.use_threads = 1
del config


from MoinMoin.request import RequestModPy

def handler(request):
    moinreq = RequestModPy(request)
    return moinreq.run(request)