[mod_python] mod_python.publisher and PythonHandler

Alexander Steinert stony8 at gmx.de
Sat May 18 15:46:33 EST 2002


> Well, I'm not sure how closely my experiences mirror those of other 
> mod_python developers, but I can try to give you some insight. (I spent 
> about two years writing almost exclusively in PHP, and am now adjusting 
> to mod_python)
[Very nice description of an request handling example snipped ...]

I do it in a similar fashion:

Tail of /etc/apache/access.conf:

    # ddd is our BASE directory.
    <Directory /var/www/ddd>
	RewriteEngine On
	# Redirect requests for BASE/ externally to the german start page.
	RewriteRule "^$" /ddd/de [L,R]
    </Directory>
    # Identify requests for dynamic wdps content by URL pattern. Examples:
    # http://host/ddd/de
    # http://host/ddd/en
    # http://host/ddd/de/ACTION
    # http://host/ddd/de-SESSIONID/ACTION
    <LocationMatch ^/ddd/[a-z]{2}($|(-[0-9a-f]{40})?/)>
	PythonPath "sys.path + ['/usr/local/lib/wdps/python']"
	SetHandler python-program
	PythonHandler wdps.ui.web.handlers
	PythonDebug On
    </LocationMatch>

ACTION can be:

    cancel_order
    change_constants
    change_document_types
    change_groups
    change_languages
    change_person
    change_study_programs
    delete_person
    enter_payment
    enter_pickup
    help
    quit_session
    register_person
    search_person
    show_changes
    show_document_types
    show_languages
    show_order_items
    show_orders
    show_overview
    show_person
    show_postings
    show_startpage
    show_study_programs
    start_session
    ...

For each ACTION I have a class, e.g. Start_session, which is a subclass
of Action, where common behaviour (session_id checking, argument type
checking) is defined.

Originally I started with the Publisher handler, but now am very
satisfied with my OO approach.

I might publish my code (it's not ready) if you want more information.

HTH

Stony




More information about the Mod_python mailing list