[Zope] Getting a "Handle" to a ZODB object to store in another object

Tom Jenkins tjenkins@devis.com
29 Nov 2001 09:11:00 -0500


There's also zopelabs recipe that may be what he wants...
http://www.zopelabs.com/cookbook/1003844578

On Thu, 2001-11-29 at 08:55, Casey Duncan wrote:
> On Wednesday 28 November 2001 06:06 pm, John Ziniti allegedly wrote:
> > Hi all,
> >
> > I would like to have an object in one folder be referenced
> > by another object in another folder (think symlinks
> > in UNIX) ... but I'm not sure what properties an object
> > has that identify it's absolute location (absolute_url
> > is a little fluffy, no?).
> >
> > Anyone have any ideas on how to approach this?
> >
> > Thanks in advance,
> >
> > Ziniti
> 
> I think Chris M. alludes to this, but it is actually trivial to "mount" an 
> object in multiple places in the ZODB. However, the two objects will need to 
> have the same id, due to the way Zope objects currently identify themselves.
> 
> It is theoretically possible for infinite acquisition loops to happen I think 
> too, so if your Zope instance turns into a black hole and swallows the entire 
> universe, don't say you haven't been warned. 8^)
> 
> Here is the code, which could be put into an external method, folder is any 
> folderish object decending from ObjectManager:
> 
> from Acquisition import aq_base
> def mountAgain(object, folder):
>     folder._setObject(object.getId(), aq_base(object), set_owner=0)
> 
> If the objects in question are not "full Zope objects", that is they do not 
> show as individual objects in the ZMI, then you can do as Chris suggests and 
> just reference the object from another place.
> 
> hth,
> /---------------------------------------------------\
>   Casey Duncan, Sr. Web Developer
>   National Legal Aid and Defender Association
>   c.duncan@nlada.org
> \---------------------------------------------------/
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
-- 

Tom Jenkins
Development InfoStructure
http://www.devis.com