[ZPT] using tal:attributes with <option> select and ZSQL.
Luis Lavena
luislavena@hotmail.com
Mon, 3 Jun 2002 04:59:57 -0300
Sorry reply to tis too late, but te trobule was due a comparision of string
and integers.
Wasn't checking the result from the PyScript and that was my mistake.
Added a int comparision solved the problem.
Thanks for your reply.
Regards,
Luis Lavena
----- Original Message -----
From: "Geir Bækholt" <geirh@funcom.com>
To: "Luis Lavena" <luislavena@hotmail.com>
Cc: <zpt@zope.org>
Sent: Thursday, May 30, 2002 4:51 AM
Subject: Re: [ZPT] using tal:attributes with <option> select and ZSQL.
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="select python:path('item/idgrillasenales') ==
LL> path('params/idgrillasenales')"
LL> tal:attributes="select python:item['idgrillasenales'] ==
LL> params['idgrillasenales']"
LL> but don't work either.
don't work in which way ?
Do you get an error , or just no selected options.
LL> listacanales is a zsqlmethod, and params is a dict returned from a
PyScript
LL> which parses the current record info.
- if i assume you just get no selected options:
perhaps this could work ?
tal:attributes="selected python:item.idgrillasenales ==
params['idgrillasenales']"
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="string:${item/idgrillasenales}/${params/idgrillasenale
s}"
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="selected python:int(item.idgrillasenales) ==
int(params['idgrillasenales'])"
--
Geir Bækholt web-developer
geirh@funcom.com funcom oslo | webdev-team