PSP, Cheetah, PTL, ZOPE, etc ...

Graham Dumpleton grahamd at dscpl.com.au
Sat Aug 4 01:14:03 EDT 2001


tavis at calrudd.com (Tavis Rudd) wrote in message news:<f67cb2b7.0108031527.77c4af8 at posting.google.com>...
> That's only for the final interpolation.  If you have a method that
> returns a list of client objects and you want to iterate over that
> list to create some HTML, here's how:
> ----------------------------------------------
> <TABLE>
> #for $client in $service.clients
> <TR>
> <TD>$client.surname, $client.firstname</TD>
> <TD><A HREF="mailto:$client.email" >$client.email</A></TD>
> </TR>
> #end for
> </TABLE>
> ----------------------------------------------
> ##compare this with PSP
> <TABLE>
> <% for client in service.clients(): %>
> <TR>
> <TD><%=client.surname()%>, <%=client.firstname()%></TD>
> <TD><A HREF="mailto:<%=client.email()%>"><%=client.email()%></A></TD>
> </TR>
> <%end%>
> </TABLE>
> ----------------------------------------------

Ah, that is more what I am after. :-)

> The docs are rather incomplete at the moment.  I'm about to upload the
> latest version from the CVS, which is much more complete.  The
> Velocity project (essentially Cheetah for Java) has some good
> documentation at http://jakarta.apache.org/velocity/index.html

Had started looking at Velocity and if Cheetah is a similar thing for
Python, then it is perhaps closer to what I am after. Not being able
to find iteration etc in Cheetah documentation threw me and I hadn't
had a chance to sift through the code as yet.

> Note: 
> -You can turn off the auto-calling behaviour if you don't want it.  
> -You can use a character sequence other than $ if you wish.
> -You can do things like this:
>    $myList[3:15],  $obj.meth($a*5, kwarg1=$b)

When you say one can to $myList[3:15], does that mean that for
simple array access one can still say $myList[3]. I wasn't too keen
on the $myList.3 mentioned in documentation.

Anyway, while I think more about all this stuff, I will probably in the short
term implement support which gives equivalent interface to mod_python
in Apache. A lot of the template systems for Python have mod_python
wrappers, so if done correctly most template systems might be able to
be easily plugged in and people can use what they want. At least I think
that should work. :-)

When I get a chance, will also look more at Cheetah itself as the documentation
may not be the best guide right now as to what it can do.



More information about the Python-list mailing list