[ZPT] Truncating strings (and more...)

Charlie Clark charlie at begeistert.org
Thu Oct 23 04:30:08 EDT 2003


On 2003-10-23 at 04:47:58 [+0200], Shane Hathaway wrote:
> On Tue, 21 Oct 2003, Ian Bicking wrote:
> 
> > [I think tal:format would imply structure]  But the current access to 
> > these sorts of functions through the modules variable is painful at 
> > best.  And it seems like the functions in PythonScripts.standard are a 
> > little sparse.
> 
> Once again, this would be beautifully simple with subpath prefixes. 
> Behold:
> 
> <span tal:content="var/fmt:truncate/10"></span>
> 
> I keep trying to tell everyone why this is so great.  Does anyone listen? 
> :-)

Listening hard but failing to see. How do you like my mixed metaphor?

On 2003-10-23 at 09:04:50 [+0200], Tino Wildenhain wrote:
> Hi Ian, Shane,
 

> The most obvious problem is: ZPT is constantly extended for misuse.
...
 
> What on earth is wrong with preparing the data before use in ZPT? Most of 
> the problems are solveable yet with python scripts.
> 
> If the tools are not sufficient, why not improve the tools and let ZPT 
> alone?

Agree entirely. Maybe it's just another poor example but truncate isn't 
necessary - just slicing the string [:10] does the trick. Extending ZPT / 
TAL to do anything that is already possible in a Python expression is a bad 
thing TM in my book as it violates the principle of "there being one and 
preferably only one (obvious) way of doing things". Besides I'm sure 
extending ZPT is just bound to make it slower than it already is. I know 
that Tino is a great fan of CSS but in my experience there are too many 
browsers out there that don't do all the latest and greatest CSS stuff and 
expecting your clients to behave properly isn't always advisable.

Charlie



More information about the ZPT mailing list