[ZPT] using tal:attributes with <option> select and ZSQL.

Geir Bækholt Geir Bækholt <geirh@funcom.com>
Thu, 30 May 2002 09:51:57 +0200


on or about, Thursday, May 30, 2002, we have reason to believe that
Luis Lavena wrote something along the lines of :

LL> Hello, some comparing isn't working, been trying tis a few ours and can=
't
LL> get it to work, have checked and compared the code with other working
LL> tal:attributes, but didn't work...

[snip]

LL> have tried:

LL> tal:attributes=3D"select python:path('item/idgrillasenales') =3D=3D
LL> path('params/idgrillasenales')"
LL> tal:attributes=3D"select python:item['idgrillasenales'] =3D=3D
LL> params['idgrillasenales']"

LL> but don't work either.

don't work in which way =3F
Do you get an error , or just no selected options.


LL> listacanales is a zsqlmethod, and params is a dict returned from a PySc=
ript
LL> which parses the current record info.

- if i assume you just get no selected options:

perhaps this could work =3F
tal:attributes=3D"selected python:item.idgrillasenales =3D=3D params['idgri=
llasenales']"

if i run into unexpected behaviour when doing comparizations like this
, i try to print both variables being compared in the value of the
select , so that it is simple to see the problem:

tal:attributes:value=3D"string:${item/idgrillasenales}/${params/idgrillasen=
ales}"


also make sure both items being compared are of the same type.. Much
frustration can be had by trying to compare integers and strings:

tal:attributes=3D"selected python:int(item.idgrillasenales) =3D=3D
int(params['idgrillasenales'])"


--=20
Geir B=E6kholt                      web-developer
geirh@funcom.com             funcom oslo | webdev-team