[Zope] truncation

Paul Winkler pw_lists@slinkp.com
Tue, 13 Aug 2002 07:26:02 -0700


On Tue, Aug 13, 2002 at 04:02:44PM +0200, STACCINI PASCAL CHU Nice wrote:
> hello
> I would like to know if there is a way to truncate a string while displaying
> it in a table using TAL, as the following code allows it in classic DTML
> code : <dtml-var mystring size=10 etc=", etc.">. 
> actually the TAL code is : <td tal:content=mystring>dummy string</td>
> thank you for your answer

TAL doesn't provide this, but you can use a python string slice:
<td tal:content="python:context.mystring[:10]">dummy string</td>

You might need to use something other than "context", depending
on where "mystring" comes from. 

--

Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"