[ZPT] preventing escaping of less-than and greater-thans in
tal:replace
Charlie Clark
charlie at begeistert.org
Mon Aug 14 13:45:35 EDT 2006
Am 14.08.2006 um 19:27 schrieb Don Morrison:
>> Eek string replacements are so much uglier than Python string format!
>> Is it just me who thinks what you're doing is wrong.
>
> Charlie, I just said myself it was wrong and I'm asking for help
> because even if it did work it would be ugly and inelegant. I left it
> wrong to show you I'm trying to prevent escaping. Don't pretend to not
> understand this just to make fun of me. :)
I wasn't making fun of you.
>> Anyway I think what you're after is tal:source which is very much in
>> the Zope Book in the chapters on PageTemplates.
>
>
> I don't see it in 2.6 or here in 2.7:
Sorry, it's "structure" you want to use.
<tal:replace="structure <some tag or other>">
Now, if you are going to generate some complex tag then you are best
of doing this in a PythonScript and returning the string to the
template. However, I do not think that is the way to want you want as
I this only makes sense for extremely dynamic content. In my view
it's better to use standard tags.
Your source is virtually impenetrable to me which I think is a guide
to it being wrong.
<span tal:define="r record/name; id record/task_id; mylt
string:'<'; mygt string:'>';"
tal:replace="string:${mylt}option label='${r}'
value='${id}'${mygt}${r}${mylt}/option${mygt}"></span>
<option tal:attributes="label record/name; value record/task"
content="record/value"></option>
No formatting required at all. At least I think that's what you want!
Charlie
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
More information about the ZPT
mailing list