Kevin Carlson wrote at 2005-10-10 18:37 -0400:
>I'm not sure I understand what you mean by fixing them all as shown 
>above.  You mention loading the object from the ZODB and deleting the 
>broken references, but I'm not sure how to do that.

"fsrefs" tells you the OID of objects containing broken

When you have the OID (as binary value; I think
"fsrefs" tells you the hex value, then can use "hexvalue.decode('hex')"
to get it as binary), you can load the respective object

        obj = connection[OID]

You get the connection from an object via "obj._p_jar".

In your case, an "OOBucket" lost some of its references
(that is an easy case -- provided it does not loose all its content).

  You determine the broken keys and delete them:

    for k,v in list(bucket.objectItems()):
      try: v._p_changed = 0 # load the object
        # broken
        del bucket[k]

  The case becomes very complicated, when the bucket ends
  empty -- an empty bucket would make the (probably) enclosing
  BTree invalid. You would need to fake something to
  keep it non-empty.

    if not bucket: bucket[k] = None # "k" was one of the deleted keys

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to