[ZODB-Dev] Find references to an object

Greg Ward gward@mems-exchange.org
Mon, 13 Aug 2001 13:12:15 -0400


On 12 August 2001, Barry A. Warsaw said:
> This is easier.  Use the storage's load() or loadSerial() method to
> get the pickle for the specific oid/version/serialno combination.
> Then use ZODB.referencesf.referencesf() to get the list of oids
> referenced in that pickle.  E.g.
> 
>     from ZODB.referencesf import referencesf
>     pickle, revid = storage.load(objAoid, '')
>     refdoids = []
>     referencesf(pickle, refdoids)
>     if objBoid in refdoids:
> 	blah()

Cool, that works.  Thanks -- you've just saved me much groping through
FileStorage.py, or the perpetration of an evil nasty hack.  (I was
thinking of reading in chunks of the file myself, based on the offsets
on storage._index... *blechh*)

        Greg