[mod_python] publisher cgi

Graham Dumpleton grahamd at dscpl.com.au
Tue Nov 7 15:39:22 EST 2006

On 07/11/2006, at 10:14 PM, Gregor Kling wrote:

> Hash: SHA1
> Hello,
> With a short glimpse at mod_python's publisher default handler, I
> assume I have to use 'raw' cgi's, if i have variable form data ?

To clarify one point. The publisher extension handler for mod_python
is not the default handler. Instead it builds on top of the basic  
mechanism of mod_python. How you use publisher is different to
basic handlers in mod_python.

I point out the difference as too often people don't understand they
are different and mistakenly starting trying to return Apache status
codes as the result of a published function when they shouldn't. When
using publisher, the result of the function should be the data you
want to appear as content in the response. If it isn't a string, it will
be converted to one and then used as the content.

Thus, a basic handler:

   def handler(req): # No ability to have form fields as arguments.
     return apache.OK # Return Apache status code.

And publisher:

   def index(arg1, arg2): # Name of function used in URL, and form
     # fields mapped automatically to the function arguments. Use of
     # request argument as first argument is optional.
     return 'page content'


More information about the Mod_python mailing list