On Mon, Mar 08, 2004 at 09:34:28AM -0500, Jeremy Hylton wrote:
> On Fri, 2004-03-05 at 16:57, Dieter Maurer wrote:
> > >3) is it possible to disable caching of some object?
> > 
> > No, but you can (in most cases) flush it again
> > by calling its "_p_deactivate" method.
> > 
> > You can always do it by assigning "None" to "_p_changed", but this
> > is highly unsafe. You should not do it (unless you really know
> > what you are doing).
> Another was of saying this is that the cache performs an important role
> in maintaining object identity.  It's not possible to use a persistent
> object without using a cached version of it.  If you think you need to
> disable caching, you should probably say something more about what you
> are trying to do.
> > >4) when an _v_ attribute is removed, what code of the object/attribute
> > >itself is called?
> > 
> > The object's "__del__" method (if defined).
> > This means the object that was bound to the "_v_" attribute
> > not the object that had the "_v_attribute".
> The setattr hook in cPersistence.c is called when an attribute is
> removed (del obj.attr).  An __del__() method would only be called if the
> last reference to the object was also deleted.  And __del__ is to be
> avoided whenever possible.

 What I would like to do is to have an hook to the removal of a _v_
 attribute, so that I can perform some action *BEFORE* losing any
 reference to the object itself. I look at the setattr code in
 cPersistence.c and tried also to write my own __setattr__, but I do not
 know what should be called *AFTER* my code. What I would do is:

 def __setattr__(self, key, value):
     if key[0:3] == '_v_': doMyStuff()

 but I do not know what doStandardStuff actually is.

> Jeremy

Marco Bizzarri - Amministratore Delegato - Icube S.r.l.
Sede:   Via Ridolfi 15 - 56124 Pisa (PI), Italia 
E-mail: [EMAIL PROTECTED]               WWW: www.icube.it       
Tel:    (+39) 050 97 02 07              Fax: (+39) 050 31 36 588        

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to