[ZPT] Client side TAL implementation

Phillip Hutchings sitharus at gmail.com
Thu May 26 17:17:07 EDT 2005


> My question is: Is TAL meant to support data formatting or only data
> displaying? Could we for instance implement something like this: 
>
> <span tal:content=" /data/myname|capitalize"> 
> 
> I may be in a complete wrong track, but any suggestion or comments would be
> greatly appreciated! 

TAL itself can't handle processing of retrieved data, it's only for
data fetching. To do this you'd ideally create a data object that
knows how to capitalise itself, and do something like:
<span tal:content="/data/myname/capitalize">
Deferring to US spelling for the function call, to make it consistent
with most other things.

This isn't great MVC however, so a better way would be to follow your
original idea of calling a JS function, as in Zope you'd use a python
expression somewhat like this, depending on where you keep your
capitalize method:
<span tal:content="python:container.capitialize(data.myname)">
Though I'd recommend creating a string object with capitialize in its prototype:
<span tal:content="javascript:string.Capitalize(data/myname)">

-- 
Phillip Hutchings
http://www.sitharus.com/
sitharus at gmail.com / sitharus at sitharus.com


More information about the ZPT mailing list