Graham Dumpleton
graham.dumpleton at gmail.com
Mon Mar 24 02:36:56 EDT 2008
On 24/03/2008, Eric Brunson <brunson at brunson.com> wrote: > 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. It is arguable that mod_python.psp and mod_python.publisher should not even be a part of the mod_python package. Unfortunately decisions were made at some point to make it more than just a Python binding to Apache. It would have been much better that they were a separate package. To make things worse, there is stuff in the core of mod_python (even at C code level) specifically to support those packages meaning it would be quite hard to separate them from mod_python and generalise them so that they may for example be hosted on any WSGI compliant hosting mechanism. This may be a big issue with Python 3.0 because there is a big question mark over whether anyone will step forward and port mod_python to Python 3.0. As such, if the only thing you use mod_python for is as a jumping off point for a content handler, you are probably much better off using Python web toolkit that can work on WSGI as it at least has a chance of surviving going forward into Python 3.0 even if changes may need to be made to WSGI to allow it. Graham > 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 > > > >
|