[mod_python] idea for PSP

vincent delft vincent_delft at yahoo.com
Wed Feb 25 04:57:51 EST 2004


I'm using PSP since several weeks, and I would suggest
an idea for improvement.

What:
-----
my idea is to use "print" command instead of
"req.write".
>From my point of view this will simplify the PSP code;
just use print to see the html string on your html
page.

example:
--------
to illustrate it by and example, the code use in the
3.1.2b example at the chapter 4.9, will be:

print """<html>"""
import time
print """Hello world, the time is: %s """ %
time.strftime("%Y-%m-%d, %H:%M:%S")
print """</html>"""

why:
----
I personally think that this way of doing is much more
easy and usefull.
In the case of PSP, everything you send to the
standard output will be html pages.
logger exist if you need to add some "track point" in
the psp code.

How:
----
The lexer must be adapted: psp_parser.l
adapt the psp.py code by using an "exec" (instead of
eval) and redirect sys.sdtout to req.write just before
the execute.

Impact:
-------
I don't think that this will have impact on the
current PSP code (to be verified).




I've not enough knwoledge of lexer to do it by my
self. If someone is interested to look into that
direction with me ... let me know. 
I initially would see if it's feasible; if it's
backward compatible; ....

I don't want to generate a fuzzy troll on that
subject, but idea or comments are welcome.

Thanks.




__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools


More information about the Mod_python mailing list