[ZPT] Added Python code blocks to ZPT

Ian Bicking ianb at colorstudy.com
Tue May 17 23:30:53 EDT 2005


Tino Wildenhain wrote:
> -1 for me. I'd even like to remove python: expressions and
>    tal:define because of their constant abuse.

I'm proposing a carrot approach, as opposed to the stick.  Personally if 
ZPT had used the stick approach (e.g., no python: expressions), I 
wouldn't be using ZPT.  I know not everyone agrees -- certainly there's 
many templating languages where they seem proud of the fact the language 
isn't very powerful.  However, I don't generally get along well with 
stick-wielding technologists.  This has made my relationship with system 
administrators somewhat rocky at times ;)

Personally, I want Python blocks specifically to decrease the number of 
python: expressions, and many other related complications, by offering a 
cleaner alternative to address the same problems.  That problem being 
that that display logic can be very complex, and worthy of a complete 
programming language.  And yet the ZPT/controller barrier isn't about 
complexity (at least at its best) but about responsibility, and I don't 
want to push display logic back into my controllers.  That's bad for 
everyone.  The alternative would be to create a third layer; the 
"complex view" layer, as you propose...

> +1 would be a solution where you can have one python script
>    attached to the Template to prepare things - to have all
>    display related code in one place. Just like precondition
>    in images/files or as 2nd ZMI tab with pure python code.

Well, that doesn't do much for me specifically, since I'm not using 
Zope, though of course I could do the same thing relatively easily 
outside of Zope.  E.g., look for a .pt.py file or something.  And I 
might even do that; but I'd still prefer a Python block.  I hate piling 
on lots of layers.

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org


More information about the ZPT mailing list