[Zope-dev] is an object in a folder
Florent Guillaume
fg at nuxeo.com
Tue Aug 24 11:48:12 EDT 2004
> 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:fg at nuxeo.com
More information about the Zope-Dev
mailing list