#! /usr/bin/env python

"""
    MoinMoin - CGI Driver Script

    Copyright (c) 2000 by Jürgen Hermann <jh@web.de>
    All rights reserved, see COPYING for details.

    $Id: moin.cgi,v 1.2 2002/03/11 21:48:48 jhermann Exp $
"""

import sys
sys.path.append('/var/www/cgi-bin/wysimoin')

import os
if os.environ.get('QUERY_STRING') == 'test':
    print "Content-Type: text/plain\n\nMoinMoin CGI Diagnosis\n======================\n"

    try:
        from MoinMoin import cgimain
        print 'Package "MoinMoin" sucessfully imported.\n'
        cgimain.test()

        try: 
            from MoinMoin import WysiPageEditor
            print
            print 'The Wysiwyg version of the MoinMoin lib seems to be being used. :)\n'
        except:
            print 'Your module path seems to be misconfigured; can\'t find the Wysiwyg code'
            print 'Please check the sys.path modification in moin.cgi.'
            print
        
    except:
        import sys, traceback, string, pprint
        type, value, tb = sys.exc_info()
        if type == ImportError:
            print 'Your PYTHONPATH is:\n%s' % pprint.pformat(sys.path)
        print "\nTraceback (innermost last):\n%s" % string.join(
            traceback.format_tb(tb) + traceback.format_exception_only(type, value))
else:
    from MoinMoin import cgimain
    cgimain.run()

