[Zope] How the heck do I do this Python for Loop?

Bill Hewitt wphewitt at comcast.net
Mon Aug 25 07:07:23 EDT 2003


This has been driving me crazy for the last week......

I wrote a python script that loops through a directory called StyleBook
and selects a particular stylesheet based on the Day of the week, the
year and a parameter.....
---------
example:
---------

## Look for Day Year (ie - Monday 2003) in the StyleBook Directory
for i in container.StyleBook.objectValues('Style Sheet'):

 ## Check the TITLE of "i" against a preset variable and  aparameter
 if i.title = DAYYEAR and i.stylesheetrequest == stylesheetrequest:
   ### At this point I have all the variables (47 total) except the ID
:( 

This works - I get the proper Style Sheet.... 

I would *like* to then call a DTML Method against the values in the
NAMESPACE of the object I found in the code above.....

something like

return container.StyleBook.i.loadStyle()

but every variation I have tried doesnt work - I get an error telling me
that "i" is not in the global NameSpace....


Could someone PLEASE help me through this one? I know it is probably
very simple, but it is evading me...

WPH







More information about the Zope mailing list