[mod_python] PSP handler forces content_type text/html ; can this be overridden?

Graham Dumpleton graham.dumpleton at gmail.com
Sun Mar 23 06:21:43 EDT 2008

On 23/03/2008, Sidney Cadot <sidney.cadot at jigsaw.nl> wrote:
> Hi Graham,
>  Thanks for the answer. As you point out it is quite possible to generate a
>  proper XHTML content-type by going slightly 'below the surface' of PSP.
>  However as a general principle I shouldn't have resort to that. It feel like
>  bad practice to look at someone else's code, copy the relevant bits in the
>  current version of their software, and paste it into my own code, changing
>  the single line that is disagreeable for my current problem.
>  In my opinion it would be a lot nicer (from a software engineering
>  standpoint) if there were a documented way of overriding the content-type
>  that the PSP.handler() sets, that is available in the standard, published
>  interface of PSP.
>  Something like:
>  class PSP:
>     def handler(req):
>         req.content_type = config.get("PythonPSPContentType", "text/html")
>         ... etcetera ...
>  Is this the correct mailing list to suggest / argue for such a change or
>  should I head over to python-dev at httpd.apache.org ?

Here is as good as place as any, the developer list has been very
quiet for a long time.

Anyway, I would not be concerned about dropping below the surface, the
PSP object is meant to be used directly and you are not restricted to
just using the psp top level handler. Many people use PSP object
directly from publisher handlers to generate response content, often
as non HTML.

If you want to suggest something like above, best to create an issue for it at:


That way it will not be forgotten if anyone ever decides to go and do
further work on PSP.


More information about the Mod_python mailing list