On Tue, Aug 20, 2002 at 10:07:37AM -0700, 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 store the value of yday to tday and return it as tday.
Then my major problem is how to access the id from the Zcat_New1_Dtml_doc;
The code below is giving me Error Type: NameError Error Value: global name 'id' is not defined
tday=DateTime().toZone('GMT+1').strftime('%d%m%y') yday=(DateTime()-1).toZone('GMT+1').strftime('%d%m%y') for i in context.Zcat_New1_Dtml_doc(): if tday==id:
Well, you haven't mentioned "id" before this point, so of course it's not defined. Python doesn't do that <dtml-in> voodoo. Assuming Zcat_New1_Dtml_doc is a ZCatalog, then calling it will give you a list of objects. I think you want to test the id *of each object*, right? So just do: for item in context.Zcat_New1_Dtml_doc(): if tday==item.id: ... -- Paul Winkler "Welcome to Muppet Labs, where the future is made - today!"