[Zope-dev] is an object in a folder

Maciej Pietrzak M.Pietrzak at prioris.mini.pw.edu.pl
Thu Aug 26 05:02:00 EDT 2004


On Thu, Aug 26, 2004 at 08:29:19AM +0200, Christian Theune wrote:
> 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()
> 

Object might contain lots of subobjects. Returned list might be very
big.


-- 
Maciej Pietrzak
jid:horpah at jabber.org
email:M.Pietrzak at prioris.mini.pw.edu.pl


More information about the Zope-Dev mailing list