Hi Vitor, this is a faq ;) Look for documentation on ZopeFind() and ZopeFindAndApply() (The Zope source is last resort, but also google, Zope.org and the parameters on Zopes managements "Find" page) Or see the following example: http://www.zope.org/Members/chrisw/zopefind HTH Tino Wildenhain --On Mittwoch, 16. Oktober 2002 16:33 +0100 Vitor Varalonga <vpedrosa@ciberbit.pt> wrote:
Hi!
I need to check, inside a Python script, if an object with a particular ID exists inside a folder. Right now I'm using the following code:
# this is the folder I want to search myFolder = container.REQUEST.PARENTS[0].img_folder
# search the folder for an object with ID <object_id> obj = getattr(myFolder, object_id, None) if obj is not None: # there is no such object else: # there is an object with that id
Is there a more efficient way to perform this operation?
kind regards,
Vitor Varalonga