[Zope-CMF] taL: test evaluates all arguments
Ivo van der Wijk
ivo@amaze.nl
Fri, 3 Jan 2003 22:56:36 +0100
On Fri, Jan 03, 2003 at 09:59:17PM +0100, robert rottermann wrote:
> if have the following tal statement:
>
> tal:define="resp_def python:here.users_with_local_role('ObjectResponsible');
> responsible python:test(resp_def == [], '', resp_def[0]);"
>
> When resp_def is an empty list I get an index out of range error.
> This seems very strange.
>
> can anybody give me a hint what goes wrong here ??
>
test() is just a procedure invocation, and all arguments are evaluated before
the procedure is invoked.
Try resp_def[:1] in stead, i.e.
tal:define="resp_def python:here.users_with_local_role('ObjectResponsible');
responsible python:resp_def[:1];"
(or even reduce it to a single line)
Cheers
Ivo
--
Drs. I.R. van der Wijk -=-
Brouwersgracht 132 Amaze Internet Services V.O.F.
1013 HA Amsterdam, NL -=-
T +31-20-4688336 F +31-20-4688337 Linux/Web/Zope/SQL/MMBase
W http://www.amaze.nl E info@amaze.nl Network Solutions
W http://vanderwijk.info E ivo@amaze.nl Consultancy
PGP http://vanderwijk.info/pgp -=-