[Zope-dev] Re: TALES idea: tuple unpacking

Paul Winkler pw_lists@slinkp.com
Thu, 24 Jul 2003 12:37:06 -0400


On Thu, Jul 24, 2003 at 11:00:09AM +0200, Jean Jordaan wrote:
> Perhaps it's worthwhile for this thread to have a look at 
> http://www.eby-sarna.com/pipermail/transwarp/2003-July/000606.html
> http://www.eby-sarna.com/pipermail/transwarp/2003-July/000607.html
> and following to see what Phillip Eby is cooking up. 
> 
> The templates he proposes have only two or three attributes, 
> keeping logic rigorously out of the template.

Very interesting idea. Here's an excerpt:

"""
I think that ZPT still embed code in a web page, and that there's a better 
alternative.  If you've seen PSO (pso.sf.net), Twisted's Woven, or even JSP 
taglibs (though that's a bit of a stretch), you'll have a better idea of 
what PWT (peak.web.templates) looks like.  Here's an example, straight from 
the test suite:

<body>
  <h1 model="foo" view="text">Title Goes Here</h1>
  <ul model="bar" view="list">
    <li pattern="listItem" view="text"></li>
  </ul>
</body>

'view' attributes identify the object factory used to create the tag, 
'model' attributes are a path to the data to be used, and 'pattern' 
attributes identify parameters that are supplied to the nearest containing 
'view', rather like a METAL macro slot (except that views are written in 
Python, rather than being templates, although I intend to make it possible 
to use a template as a view, too).  Views are looked up in a property 
namespace so you can configure access to arbitrary view components that 
your app (or anybody else) supplies....
"""

I don't totally grok it (an object factory creates a tag?
does he mean the contents of the tag? and since they're factories written
in python shouldn't they be called something other than 'views'? like
maybe 'factory'??).  But, odd terminology aside, it's compellingly simple. 
I guess that the 'view' and the 'model' only have to agree on an 
interface ('pattern' names).

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's DEPUTY SHERIFF OF JUSTICE!
(random hero from isometric.spaceninja.com)