[mod_python] when to use PSP handler, when to use Publisher handler

Graham Dumpleton graham.dumpleton at gmail.com
Sat Dec 27 04:46:29 EST 2008


2008/12/27 David Jackson <davidj411 at gmail.com>:
> I am wondering if there are any docs that might address these questions:
>
> 1) can PSP handler and Publisher handler be used simultaneously?

Yes.

By using AddHandler for both so that files with different extensions
can exist in same directory and be processed appropriately.

Alternatively, only enable mod_python.publisher and from inside of
publisher functions access to PSP class directly to render pages you
supply references to and return that as result.

> is it advisable to use one or the other, but not both?

Depends on what you want to do.

Why are you picking mod_python/publisher/psp in the first place when
there are arguably much better alternatives available today for doing
Python web application?

> what are the differences b/t the two in terms of performance?

Hmmm, warning bells ringing. There are a lot more important things
than raw performance. You would be better of finding a system that you
like to use rather than be obsessed over performance.

> 2) what is difference b/t directives
>
>      A) AddHandler -
> http://httpd.apache.org/docs/1.3/mod/mod_mime.html#addhandler
>      B) SetHandler -
> http://httpd.apache.org/docs/1.3/mod/mod_mime.html#sethandler
>
> it seems like you could use either, but which is best? sethandler seems to
> be for all files at directory level, while addhandler allows you to specify
> the extension.

Use SetHandler and you can't mix different file types in same
directory easily as it takes precedence.

>     my httpd.conf working config is posted below, questionable parts are in
> bold.
> Can someone advise on if this configuration will work?
>
> <Directory "C:/Documents and Settings/davidj411/My Documents/www/pybin">
>   AllowOverride None
>   Options None
>   Order allow,deny
>   Allow from all
>  SetHandler mod_python
>
>  PythonHandler mod_python.publisher
>   AddHandler mod_python .psp
>  PythonHandler mod_python.psp
>
>   PythonDebug On
> </Directory>

>From memory this would cause publisher files to take precedence all
the time, you cannot normally mixed SetHandler and AddHandler within
same directory context.

Graham


More information about the Mod_python mailing list