[Zope-dev] simpler TALES. (was Re: TALES idea: tuple unpacking)
Leonardo Rochael Almeida
leo@hiper.com.br
29 Jul 2003 19:23:36 -0300
Just to throw my 2c into the fray.
ZPT is an HTML/XML template language. But what does that mean, really?
IMHO. Template languages are data structure navigation languages, or
model navigating languages (EEEK, templates having direct access to the
model!). And the should avoid being turing-complete (or make it very
inconvenient to use turing-complete functionality)
I agree in principle with Paul that we should try to reduce the number
of concepts (the difference between attribute, key and index access,
parameter-less method calling, etc) that we need to expose to template
authors (and I find the idea of removing "python:" from TALES slightly
tempting).
But right now the choice between adding or not the proposed TALES
extensions is a choice between having to explain what all those python
concepts mean before or after the poor template guy got confused why
certain things don't work as expected:
* Why must I use a tal:define="something here/getSomeObject" and
later a tal:content="something/someAttribute" instead of just
tal:content="here/getSomeObject/someAttribute".
* Why does tal:content="request/form/items" don't get me the
"items" object that I'm expecting
* etc..
In order to get to the ideal world Paul wants (and that I want too),
maybe we need to restrict the things that TALES can navigate. That would
mean we'd need to chose between TALES path navigating dictionary keys or
attribute access, but not both. Also, paths would not be able to call
anything in the last segment. On the other hand, we'd need to give
python scripters the necessary tools, ex. before ZPT, I used to find it
VERY anoying that I had to use the mapping attribute in DTML tags just
because I couldn't create MyBrain objects thru python. PythonScripts
should be able to generate the same kind of objects that ZCatalog and
ZSQL queries generate.
But in the end, it might be just too much trouble, and we're better off
teaching some python to the template guys. At least it's python, and not
Perl, PHP or vbscript.
Cheers, Leo
--
Ideas don't stay in some minds very long because they don't like
solitary confinement.