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

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


Hi Eric,

> 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.

To that, I agree. The main purpose is making the handlers accessible in
Python; the publisher- and PSP handlers are merely thin layers built on top
of that functionality. On a related note: I distinctly remember that it was
hard to understand this when I first approached the mod-python
documentation. Now that I understand, it's all there, but the learning curve
could perhaps be made less steep by being more explicit about this
distinction, perhaps by explaining this distinction crisply in the
Introduction.

> 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.

Then we must agree to disagree. The PSP handler, out-of-the-box, imposes a
content type of "text/plain" while a content-type of "application/xhtml+xml"
is certainly less usual, but also entirely reasonable in many modern
settings.

A solution would be very easy, eaven easier than my earlier proposal of
introducing a PythonPSPContentType: just piggyback on Apache's "AddType"
mechanism.

In other words: remove the line in PSP that sets the content_type
explicitly, then add a remark to the documentation that people should add
...

AddType text/html .psp

... to their htaccess or server config. I feel this is the "right" way of
dealing with this issue; the PSP module should just refrain from touching
content_type at all.

I understand that this could break existing installations, but that's what
installation notes are for. It really seems that this would be a perfect
solution otherwise.

Best regards,

  Sidney




More information about the Mod_python mailing list