[ZPT] Truncating strings

Fernando Martins fmartins at hetnet.nl
Fri Oct 24 06:55:13 EDT 2003


From: fergal at esatclear.ie
> I said this yesterday but no one replied, so here it is again.
>
> Just allow arguments to methods
>
> <span tal:replace="lib/fmt/truncate(container/path/to/var, some/length)">
>
> assuming that you shove a load of classes into some sort of collection
> stored in lib.
>
> No need for yet more namespace separators (/ is enough)
>
> No need for python syntax in tales.
>
> Anyone can see at a glance what is going on, no need for everyone to
> retrain their neural nets.

+1

>
> Nestable, should you really need.
>
> Not restricted to single arguments.
>
> Ok, so no way of doing more='...' but you can't have everything and you
> could easily add a truncate_elipsis function to fmt and you're
> laughing (in
> fact it's probably better to do that than specify more='...' all over your
> templates),
>

How would you explain in the FAQ why constants and parameter names are not
allowed? ;-)

Fernando




More information about the ZPT mailing list