[ZPT] Truncating strings

Tino Wildenhain tino at wildenhain.de
Thu Oct 23 10:50:30 EDT 2003


Hi Charlie,

Charlie Clark wrote:
> On 2003-10-23 at 13:57:24 [+0200], Shane Hathaway wrote:
> 
>>That's one of the goals you can achieve with ZPT, but it's not the real 
>>goal.  The real goal (as chosen by Zope Corporation) is to create dynamic 
>>pages without burdening either the programmer or the designer.  Complete 
>>separation does not necessarily achieve that goal.  If you want a 
>>templating language that truly separates code and design, which tends to 
>>become a burden for both programmers and designers, you should look at 
>>what Phillip Eby has been cooking.

What is he cooking? Where to find? Or do you mean ZPatterns?
> 
> 
> I have to agree with Shane here: complete separation can be a real pain - 
> XSLT anyone? ZPT is a nice compromise. You need page designers who 
> understand enuff programming to be able work with it without breaking it 
> but why does everyone thing web pages should be easy?
>  
> 
>>>What on earth is wrong with preparing the data before use in ZPT? Most 
>>>of the problems are solveable yet with python scripts.
>>
>>Should every template have an associated script?
> 
> 
> For those containing exteral data I think this is a very good rule of 
> thumb, yes. It encourages separation of logic layers so that the ZPT is 
> easier to read. Over on Zope-DB there was a very good suggestion that in 
> fact all pages should always be called by a script anyway. I've lost the 
> mail but it was very well-argued and thought provoking and, after looking 
> at some CMF / Plone source, I will certainly give it some consideration.

This was an idea I considered some times ago, in fact I thougt it
should not be so hard to just associate a script with a ZPT
maybe thru a mechanism like "precondition" is for Files and Images.
So if you register the script there, it can be used to

1) set up request namespace for the ZPT
2) optionally call another ZPT instead

as a rule: if the script returns None, Zope would publish
current ZPT, if not, Zope should publish the return value.

I think, that would be easy to use and easy to debug.

Unfortunately, I discovered ZPTs are derived from python
scripts and such a patch is not too easy.
As time permits I will publish it anyway. Maybe
someone else finds it usefull too.

Regards
Tino Wildenhain






More information about the ZPT mailing list