[Zope] Accessing individual items within a list

Passin, Tom tpassin@mitretek.org
Thu, 29 May 2003 15:39:12 -0400

[McDonnell, Larry]
> But I see this error:
> Error Type: NameError
> Error Value: global name 'pbtemp' is not defined
> The zsql is as follows:
> update atp_fields=20
> set pbtemp=3D<dtml-if pbtemp><dtml-if "pbtemp=3D=3D''">NULL<dtml-else>
>  <dtml-sqlvar pbtemp type=3Dfloat></dtml-if><dtml-else>NULL</dtml-if>
> where serial_number=3D<dtml-sqlvar serial_number type=3D"string"> and
>       cell_stack_number=3D<dtml-sqlvar cell_stack_number type=3D"int">
> The zsql works when I test it. At first I was just trying to=20
> display the
> values of pbtemp[x], but Alexis gave me zsql call statement=20
> so I that is
> where I am at now.

You have to tell your zsql method what parameters to use, and you have
to pass it those parameters.  I do not see where you do that, and that
is probably why the method does not know about the variable.

Within the zsql method, you refer to the parameters by the names you
gave them when you added them to the method definition.

Also, in the outer code, pbtemp seems to be a dictionary, where as in
the zsql method you are treating it as a simple scalar value.  So when
you do get wi working, in the future you may get confused by the name.
I would suggest using a different name for that variable to avoid the


Tom P