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

Graham Dumpleton grahamd at dscpl.com.au
Thu Aug 2 21:00:33 EDT 2001


tavis at calrudd.com (Tavis Rudd) wrote in message news:<f67cb2b7.0108021001.4013ee64 at posting.google.com>...
> > Although with a template system like Cheetah you might be able to map a
> > function to a particular exported method of a service, as far as I can
> > see, it would always be the case that such a function must return text
> > capable of being included into a web page. 
> 
> Cheetah works with any type of data, not just text. It doesn't force
> you to do anything like that.

The documentation when talking about placeholders says that if the value
is not a string, it applies str() to it, or if the value is callable that
it calls it and then applies str() to the result.

> > With PSP, the method of a
> > service object could return some data structure, which the in place code
> > could iterate over to produce the actual HTML.
> 
> Like PSP, Cheetah can iterate over data structures in place.  Please
> take a look at the Cheetah Users' Guide for more information:
> http://www.CheetahTemplate.org/learn.html
> Again, nothing about Cheetah's core is HTML-specific.

Can you be more specific as to where in the documentation. I have looked at
the documentation and found no clear example showing that this can be done.
If it is the macros feature, there is no documentation on it.

> > To this end, approaches relying on Python
> > scripting in some form, such as PSP or PTL may result in a system more
> > able to harness the features of the back end system.
> 
> Cheetah has a plugin that enables PSP, if that's what you really want.
>  However, *SP style coding quickly becomes a tangled mess.  Cheetah
> was designed to provide a cleaner separation of content, graphic
> design and program logic than the *SP languages.

I agree that *SP looks horrible and can become a mess. I think PSP in
particular is potentially worse than others *SP implementations if one
tries to use space or tab indenting ala Python style. Makes editing of
the page potentially complicated.

> > In the architecture I have, I guess I am uncomfortable about having code
> > related to presentation mixed up in the service objects. 
> > I suppose that
> > some service objects may specifically relate to presentation, but in the
> > main I would want to preserve the idea of services returning data related
> > to the model, rather than a view of that model.
> 
> Ditto. That's exactly why I dislike PSP, PHP, etc. and is why we
> created Cheetah.

Huh? I am not sure your comment shows agreement with my thinking. I don't
want presentation code in service objects as those service objects may be
in totally distinct processes from where the web server engine is. Ie., I am
not just extending an existing web server like Apache but putting the web
server in a distributed application. I therefore see some benefit of having
the code which renders the view of the data obtained from the remote service
object in the same place as the HTML template. To this end PSP is possibly
a good approach to solving the problem as it allows the code within the page
to manipulate the raw data structures into its HTML form. My comment wasn't
thus to suggest PSP is bad in principle, although as I have said, it looks
a mess.

The architecture of the system I am dealing with is somewhat different to
systems around. It isn't necessarily easy to capture it in a few words,
so I imagine you might be thinking of a somewhat different model than what
I am. Anyway, will keep looking at what people are suggesting and take note
of peoples comments.



More information about the Python-list mailing list