[ZPT] Truncating strings
Fergal Daly
fergal at esatclear.ie
Sat Oct 25 12:27:48 EDT 2003
On Friday 24 October 2003 18:27, Fernando Martins wrote:
> > Not sure why the smiley, this is a problem.
>
> Just challenging you as it seemed you didn't want it.
Actually I did want it, but I thought maybe no one would notice and I could
just concentrate on convincing people that method arguments are good before
dealing with constants ;-)
> > however there is a problem with parsing that. The string: construct has no
> > end marker,
>
> The end marker could be the comma. If you need a comma in the string, double
> it.
Maybe.
> I don't like so much the quote approaches because it's quite common (for me
> at least) to have single quotes in string: values. (I would have to do
> frequent escaping)
Are single quotes more common than commas? Would the strings that you pass
into methods be long ones? I would have thought that long strings tend to be
static parts of the HTML doc or are stored in variables. Do you have lots of
python: calls in your current template that include long strings?
> > truncate(this/thing, 10, more='...')
>
> How about truncate(this/thing, 10, param/more/'...')?
I think
param:more='...'
param:more=this/thing
might be more suitable. I'm not a Python person so I don't mind too much!
In the end the whole idea is to make it easier to do the simple, useful things
are currently done with a quick "python:". I also think it's quite strange
that you can call methods using TALES but you cannot pass arguments,
F
F
More information about the ZPT
mailing list