[PEAK] Traversal, views, and templates = PWT, Reloaded

Phillip J. Eby pje at telecommunity.com
Mon Aug 23 22:34:15 EDT 2004


At 10:06 PM 8/23/04 -0400, Duncan McGreggor wrote:
>Phillip,
>
>Have you had a chance to view the source of nevow yet? They made use of a 
>lot of Zope/TAL ideas in very clever and very clean ways. It's the best 
>templating I have seen in a while... and I'm a big fan of Zope/TAL :-)

The current version of PWT was inspired by the old Woven 
"model/view/parameter" tags, and also influenced by PSO.  The old woven had 
three attributes, and PSO used only one: I compromised and used two.  :)


>Quick overview and sample code snippets:
>http://www.divmod.org/Home/Projects/Nevow/index.html

Glancing it over, it looks like they renamed the old "model" attribute to 
"data" and "view" to "render", but I don't see what happened to 
parameters.  I thought that parameters were the coolest thing in Woven, and 
that's why I'm so set on keeping their power in PWT.


>I'd be very curious to hear your thoughts on what they did as well...

PWT today isn't much different from Woven/Nevow, in *language* terms.  That 
is, the base languages are comparably expressive.  The availability of 
widgets, however, is probably much better for Woven/Nevow.

The "next-generation PWT" that I laid out in my message expands the 
expressive power of the language a great deal over "old PWT" (and by 
implication, over Woven/Nevow as well).  Specifically:

  * Type-specific, named views will be available, not as methods of a 
"Page", but as globally registered adaptations from arbitary types

  * PWT-NG supports targeting either an XML element or its contents, 
permitting more precise control

  * PWT-NG is extensible with as many "verbs" as you like, and those verbs 
can be built using other templates written in PWT-NG, with the same 
execution speed as if those templates were hand-coded into the enclosing 
template.

  * Because the "rendering" and "data" are expressed in a single attribute, 
PWT-NG is a more compact notation.  Taking an example from the Nevow page, 
spelled:

     <span nevow:data="name" nevow:render="colorful" />
     <span nevow:data="fun" nevow:render="colorful" />

    In PWT-NG, you would spell this:

     <span this:colorful="name" />
     <span this:colorful="fun" />

    Or:

     <span this:replace="name/@@colorful" />
     <span this:replace="fun/@@colorful" />

   depending on whether "colorful" was an all-purpose global widget (the 
first format) or a view that can have different renderings registered for 
different object types.

  * Because PWT-NG's architecture is decentralized, with both DOMlets and 
views being independently creatable and globally reusable, I expect it to 
be better able to scale for complex applications with components (DOMlets 
and views) developed by different people.

It will probably take some time to catch up to Woven/Nevow in terms of 
available widget capabilities, however.




More information about the PEAK mailing list