[ZODB-Dev] How do you "wake up" sleepy persistent objects?
Jim Fulton
jim@zope.com
Fri, 12 Oct 2001 10:27:46 -0400
Chris Withers wrote:
>
> Jim Fulton wrote:
> >
> > The only time to mess with a __dict__ is when you actually want
> > to defeat the normal persistence machinery.
>
> ...or acquisition :-S
>
> What's the recommended way of _really_ finding out whether an object has an
> attribute and making sure it hasn't been acquired?
>
> (I used to use obj.__dict__.has_key('foo') but now i'm not sure...)
hasattr(object.aq_base, name)
or, if you aren't sure that th object is wrapped:
hasattr(Acquisition.aq_base(object), name)
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org