[Zope] objectmanager contains object test
Kevin Carlson
khcarlso@bellsouth.net
Wed, 18 Dec 2002 12:02:27 -0500
try this:
if hasattr(context.data.news, object_id) :
...
Hope that helps,
Kevin
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ben
Avery
Sent: Wednesday, December 18, 2002 11:53 AM
To: zope@zope.org
Subject: [Zope] objectmanager contains object test
this is probably really simple, but I can't figure it out from the API docs.
I want to test to see if a folder contains a dtml method with a known
id. how do I do this from python?
I've tried
if context.data.news[ object_id ]
which breaks with a key error, if it doesn't exist.
I want something like context.data.news.has_key( object_id )
but object manager doesn't seem to have any methods like that.
and doing a try, and catching key errors seems a messy way to do it.
_______________________________________________
Zope maillist - Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )