[Zope] if object does not exist in python

Andrew Milton akm at theinternet.com.au
Tue Dec 12 23:48:16 EST 2006


+-------[ David Bear ]----------------------
| Can anyone show me code examples of a script that checks for the
| existences of a named object?

if namedObject in container.objectIds():
  # object exists
else:
  # doesn't


Checks for named object inside the container that the script is in.

-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list