> 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
ZPT mailing list

Reply via email to