[Zope-dev] is an object in a folder

Christian Theune ct at gocept.com
Thu Aug 26 02:29:19 EDT 2004


Am Di, den 24.08.2004 schrieb Florent Guillaume um 17:48:
> > from Acquisition import aq_base
> > ...
> >     def hasObject(self, id):
> >         """Test if an object is in the current object.
> >         """
> >         if hasattr(aq_base(self), id):
> >             return 1
> >         return 0
> 
> It would be nice and faster but it doesn't work for non-subobjects
> attributes. For instance your hasObject('meta_type') or
> hasObject('isPrincipiaFolderish') would return true.

Isn't that what objectIds() is for?

return id in self.objectIds()

Christian
-- 
Christian Theune <ct at gocept.com>
gocept gmbh & co. kg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20040826/29ad6acb/attachment.bin


More information about the Zope-Dev mailing list