[mod_python] PSP content-type problem

Robert Fendt rmfendt at web.de
Sun Sep 26 02:06:42 EDT 2004


And thus spake "Kamil Niechajewicz" <kamil at nvstudio.pl>
Sat, 25 Sep 2004 22:42:31 +0200:

> yeah, i agree with you. this should be changed.
> i have different matter that concerns me. actually psp instantly
> does req.write while processing the template, so its possible that
> only part of the page will be displayed due some processing errors
> (like using not supported by 'vars = {}' key name etc.) when it
> occurs we get an ugly error inside our page that was partially
> displayed to the user. that is not a very pretty solution.
> i wonder whether there is an option of making psp some more
> configurable when it comes to sending content to user. i'd like
> to buffer it and send it at once (if everything went okay), or
> send some nice page informing about runtime error.
> what are the good parts of sending the content on the fly when
> template is processed, and not buffering it and sending it later
> when all is done properly? does it have some performance impact?

I think that matches with my earlier remark about psp.PSP.__str()__ not
actually returning a string (in fact, it returns ""). In my opinion, it
really should do that. If so, you can do something e.g. like

page = str(psp.PSP(req, 'page.psp'))

and then determine if the rendering went alright. For example, you can
call it like this in the publisher handler and in case of error, you
include a simple, clean error message. Or you can store the output for
repeated use. There would be several advantages, I think, of __str()__
actually returning what it should. Just my $0.02.

Regards,
Robert


-- 
encrypted (or at least signed) email preferred
public PGP key available (e.g., via http://pgp.mit.edu/)
key type: DSS/DH; key ID: 1789F5DF
key fingerprint: F7A5 2001 2D35 A7FA C56E  E87F 369B ED81 1789 F5DF


More information about the Mod_python mailing list