version 0.7.0a of Python Server Pages

Jon Brisbin mail at jbrisbin.net
Fri Sep 29 16:14:25 CEST 2000


Cary O'Brien <cobrien at Radix.Net> wrote in message
news:8qtkoc$jmt$1 at saltmine.radix.net...
> Couple-o-things
>
> 1) Isn't there another Python Server Pages project out there, one
>    that uses JPython?

yes...the webware distribution also has a PSP implementation, as does the
mod_snake project...there are also a number of home-grown PSP
implementations floating around...

> 2) Is this a pure interpreter, or are the pages turned into byte-compiled
>    python .pyc files?

basically, it simulates the JSP implementation in that it turns your webpage
into pure python code by putting print """\ ... """ around your HTML, and
using the [$...$] convention to indent your code (i.e. for if's def's
while's , etc...) and the [+...+] but putting a print statement in front of
that block...then it exec's your code *within* the current namespace, which,
to me, is important for cuurent and later functionality that isn't built in
quite yet...it does *not* compile the code, however...it just parses it to
create pure python code, then exec's that...the compilation and caching
feature is down the line...

i *first* wanted to create an implementation that was extremely small and
easy to integrate with the absolute most set-ups without making you install
anything extra, or depending on some other package to be installed for this
to work...eventually there will be fastcgi support, mod_snake (probably the
first supported), and several others...

> 3) Any reason not to switch to the JSP <> based tag format?  People, and
>    more importantly web-page editors, are used to looking at <> based
tags.

my implementation of PSP will support several diffent syntax types, like
ASP/JSP (<% and <%=) and PHP (<?...?>)...another PSP implementation uses
<%psp %>...but I personally like the Embeded perl method, which is the one I
adopted for several reasons...the most important of which is that my parser
must use the second character of the delimiter to determine what to do with
that block of code.  i suppose i could have used the <%@ syntax instead of
[$, but what I'm using now is one character less to type, and the length of
the delimiter doesn't change (always 2 :-).

while working on this, i usually have the Page.proc_total_time (or
self.proc_total_time :-) displayed on my pages and I notice that every
single line of code that is inserted that has to do something to parse my
code bumps the time up by 1 or 2 thousandths every line...so I'm going to
constantly try and lessen that by keeping fancy stuff to a minimum and not
do anything more than absolutely neccessary to parse and exec the code...

> Keep up the good work!

thanks!

Jon Brisbin
Python ServerPages
http://www.jbrisbin.net/PythonServerPages






More information about the Python-list mailing list