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

Eric Brunson brunson at brunson.com
Sun Mar 23 12:06:14 EDT 2008


Sidney Cadot 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 relevanu uuuu uu    bt 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.
>   

I disagree.  The purpose of mod_python is not be the ultimate request 
handler out of the box, I feel it's main purpose is to allow a developer 
to write his own apache handlers without resorting to C.  It is 
documented that, though fully functional and usable as is, the publisher 
handler supplied in the distribution is merely an example of what a 
publisher can do and can be used as the basis for your own code.  
Similarly, the PSP handler, while functional and capable of meeting the 
needs of 90% of its audience, is a basis for extension.

I wouldn't oppose a patch the the default PSP handler to your ends if 
you submitted one, but it definitely lies in a gray area at the top of a 
slippery slope, to mix metaphors.

Just my two cents,
e.

> 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
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>   



More information about the Mod_python mailing list