[ZPT] repeat trick
Peter Bengtsson
mail@peterbe.com
Wed, 11 Jul 2001 09:19:33 +0200
Alrite Even,
which one is best
"""
tal:content="python:test(users, string.join(users, '\n'), '')"
"""
or
"""
tal:content="python:string.join(users or [],'\n')"
"""
The second one looks more pythonic but the first one more ZPTic
Peter
> Matthew Almond wrote:
>
> > Okay, I tried some of this out - neither my, or Evans seem to work
(though
> > mine does work for another similar problem) - The problem is that test()
> > evaluates both the true and false part (as it's a function) and even if
the
> > true part isn't used, it's evaluated.
>
>
> D'oh! Forgot about that. Try this:
>
> tal:define="users here/getUsers | nothing; string modules/string"
> tal:content="python:string.join(users or [],'\n')"
>
>
> Cheers,
>
> Evan @ digicool
>
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt