template

Remi Delon remi at cherrypy.org
Wed Aug 14 09:59:12 EDT 2002


>> A couple years ago, I took a look at a bunch of such templating
>> programs, only to find that not a single one did exactly what I
>> wanted.  And I've noted that this seems to be common: we seem to be
>> very picky about our HTML generating tools.  This is evidently why we
>> have so many of them.
>>
>> This also seems to be a common educational project; it was in my case.
>>
>>
>> > Of course, my preference goes to the CherryPy syntax ... maybe because
I
>> > wrote it :-)))
>>
>> Why, what was wrong with Zope, WebWare, SkunkWeb, PSP?  :-)

There was nothing wrong with them, but I think CherryPy's is a little easier
to use. CherryPy actually has 2 templating languages:
- One that addresses the specific problem of being able to edit the
templates with HTML editors without losing the dynamic information.
- The other one is very close to the first one but it is a little simpler
because we don't have that constraint. You can use it for any type of output
(javascript, css, xml, ...)
- Both are very simple (only 6 tags), but they are nonetheless powerful.

AFAK, the only other templating language that is "HTML-editor-safe" is ZPT.
But I think ZPT is *really* complicated (especially if you compare it to
CherryPy).
In CherryPy, you write:
Hello, <b py-eval="name">world</b>

The HTML editor will just display "Hello, world", and it will leave the
"py-eval" attribute alone. When the page is rendered in a browser, "world"
will be replaced by the value of "name".

Cheers.

Remi.






More information about the Python-list mailing list