On Sun, Mar 02, 2003 at 04:34:57PM +0100, volker.wend@efgbsh.de wrote:
He folks,
I need a solution to format a title in lowercase all the time. I have an object with a title
<a class="navigation" target="main" tal:attributes="href url" tal:content="r/object/title_or_id">ID</a>
What would be the right way of converting the title to lowercase ?
as with a lot of things in TAL, the answer is that there is no built-in TAL gunk for that so you use python: <a class="navigation" target="main" tal:attributes="href url" tal:content="python: r.object.title_or_id().lower()">ID</a> explanation: path expressions like "r/object/title_or_id" are equivalent to python object containment like r.object.title_or_id. but path expressions will automagically call the last item on the path if it's callable, and you have to explicitly do that in python with (). Next, the result of title_or_id is a string, and python strings have lots of useful methods. some_string.lower() returns a lowercased copy of the input string. -- Paul Winkler http://www.slinkp.com