[ZPT] Truncating strings
Shane Hathaway
shane at zope.com
Thu Oct 23 19:29:17 EDT 2003
On Thu, 23 Oct 2003, Fernando Martins wrote:
> The solution proposed previously
>
> <span tal:replace="var" tal:format="formatters/truncate">
>
> solves all the problems except support for several parameters. The cost is
> apparent overtyping. A possible compromise is:
>
> <span tal:replace="var; fmt.truncate(10, more='...')">
The semicolon is not currently recognized by tal:replace, so this is a
backward compatibility risk.
> But, quite frankly, I don't feel convinced about this need. I really would
> like to see a convincing example.
There are many examples in the archives of this list and zope3-dev.
Clearly, complete consensus is not possible, yet this is a big hole in
ZPT. It's much larger than just formatting output. The problem is that
path expressions are deeply bound to Zope 2. As soon as you take away
implicit acquisition, path expressions no longer solve the right problems
and you suddenly have to write most expressions as Python expressions.
That would be a major loss.
Something has to give: we need to enhance path expressions, introduce a
better expression type, or make some amazing leap in the tool set. If one
of these doesn't happen, it seems like it's going to be pretty painful to
write templates for Zope 3.
Shane
More information about the ZPT
mailing list