[Zope] Python and getting first object

Tuttle, Gene cetuttle at rottlundhomes.com
Mon Sep 13 13:30:36 EDT 2004


I am new to Zope.
I have a folder tree of PDF documents.
The documents are location and division specific. 
IE:  a lot hold pdf will contain the same field data but will display
different logos or text depending on the location.
A form may also be generic. 

given this folder structure

PDFforms
	DavidBernard
 	Rottlund
                    MN
                    WI
                    IA
                    FL

In these folders are PDF documents.
Each document will have a property of 'generic_name' and 'active'
I want to use python to search starting at the lowest level in the tree to
find the first document that 
matches the generic_name and active properties

I used this code snipit.

for object in context.SAS.PDFforms.rottlund.mn.objectValues():
	if object.getProperty('generic_name') == 'lothold':
		print object.title
return printed

but this did not find the form in the Rottlund folder that matched the
request.
If i use:
for object in context.SAS.PDFforms.rottlund.objectValues():
	if object.getProperty('generic_name') == 'lothold':
		print object.title
it finds the document ( note the path changed - the mn)

Can someone point me in the right direction.

Thanks 
Gene


More information about the Zope mailing list