> 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.
The goal of hasObject, as I see it, is to check if the object is
considered a real subobject. That's what BTreeFolder2's does.
> The same idiom is used in ObjectManager.checkValidId, FWIW.
Yes but the use case is slightly different IMHO.
Florent
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 71 59 http://nuxeo.com mailto:[EMAIL PROTECTED]
_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )