[Zope] python script error: pls help

Casey Duncan casey@zope.com
Tue, 20 Aug 2002 14:24:20 -0400


Maybe try:

if tday=3D=3Di.id:

If you are trying to access the id from the metadata. It might be clearer=
 with=20
a more descriptive iterator variable, such as "doc" or something.

hth,

-Casey

On Tuesday 20 August 2002 01:07 pm, Sir K wrote:
> I have a Zcatalogue that store id of Dtml docs as part of the meta_data=
,
> then i want to iterate over it and see if at least there will be one id
> that equal to tday and return the value assigned to tday or else to sto=
re
> the value of yday to tday and return it as tday.
>=20
> Then my major problem is how to access the id from the Zcat_New1_Dtml_d=
oc;
>=20
> The code below is giving me=20
> Error Type: NameError
> Error Value: global name 'id' is not defined
>=20
> tday=3DDateTime().toZone('GMT+1').strftime('%d%m%y')
> yday=3D(DateTime()-1).toZone('GMT+1').strftime('%d%m%y')
> for i in context.Zcat_New1_Dtml_doc():
>      if tday=3D=3Did:
>          return tday
>      else:
>          tday=3Dyday
>          return tday