5.1.1 Python*Handler Directive Syntax

All Python*Handler directives have the following syntax:

Python*Handler handler [handler] ...

Where handler is a callable object (e.g. a function) that accepts a single argument - request object.


A handler has the following syntax:

module[::object] [module::[object]] ...


Object can also contain dots, in which case it will be resolved from left to right. During resolution, if mod_python encounters an object of type <class>, it will try instantiate it passing it a single argument, a request object.

If no object is specified, then it will default to the directive of the handler, all lower case, with the word "Python"removed. E.g. the default object for PythonAuthenHandler would be authenhandler.


PythonAuthzHandler mypackage.mymodule::checkallowed

For more information on handlers, see Overview of a Handler.

Side note: The "::" was chosen for performance reasons. In order for Python to use objects inside modules, the modules first need to be imported. However, if the separator were simply a ".", it would involve a much more complex process of sequentially evaluating every word to determine whether it is a package, module, class etc. Using the (admittedly un-Python-like) "::" takes the time consuming work of figuring out where the module ends and the object inside of it begins away from mod_python resulting in a modest performance gain..

What is this????