[Zope-dev] References, persistence, BTrees

Phillip J. Eby pje@telecommunity.com
Thu, 03 Jan 2002 21:48:29 -0500


At 05:49 PM 1/3/02 -0700, Jeffrey P Shell wrote:

>'subscriber' is a reference to the subscribing object, and it's very 
>likely to be to an object in the ZODB.  Is it wise to have more than one 
>persistent reference to a single persistent object?
>I swear that I had once heard Jim say (vocally) that you could do 
>references like this in the ZODB now.  I'm trying to avoid using Paths 
>because objects have a tendency to move around[*], and I have performance 
>concerns for a single event service object to have to call 
>'unrestrictedTraverse' to every subscriber.

Unfortunately, you can't take this shortcut.  Not because you can't store 
or retrieve references in this way, but because you can't get an 
acquisition context this way, which means security is shot, not to mention 
things like objects knowing their URLs.  So although it's perfectly safe to 
point to objects in the ZODB from more than one place, it's almost always 
useless to do so with respect to an arbitrary Zope object.  :(

I don't know if this is changing in Z3, but I'm rather curious about the 
possibility, myself.