You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Robert Fendt <rm...@web.de> on 2004/12/04 18:28:17 UTC
PSP content-type behaviour
Hi,
I brought up this issue a while back on the mod-python list, but without
much reaction to the core issue: PSP templates reset the content type to
text/html, even if I set it manually to something different. Apart from
just using text/html by itself being useless in most cases anyway (e.g., I
need to be able to specify at least the character encoding!), I would like
to deliver my pages as a completely different content type where possible
(i.e., 'application/xml+xhtml', to avoid browsers capable of parsing XHTML
as XML parsing it as tag soup).
Well, I tracked my immediate problem down to __str__ in psp.py and would
like to propose the following change:
from
--------------------------------snip!--------------------------------
def __str__(self):
self.req.content_type = 'text/html'
self.run()
return ""
--------------------------------snip!--------------------------------
to
--------------------------------snip!--------------------------------
def __str__(self):
if not self.req._content_type_set:
self.req.content_type = 'text/html'
self.run()
return ""
--------------------------------snip!--------------------------------
That should not break anything, as far as I can see, but on the contrary
bring it closer to documented (and sane) behaviour. I do not have SVN
access, so could please have someone have a look at it and submit it?
Thanks and regards,
Robert