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

Sidney Cadot sidney.cadot at jigsaw.nl
Sun Mar 23 06:13:23 EDT 2008

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 ?

Cheerio, Sidney

More information about the Mod_python mailing list