Matt Hahnfeld wrote at 2006-3-13 10:23 -0500:
>A few months back, the default content types for Plone (ATContentTypes)
>switched to using AnnotationStorage instead of AttributeStorage for
>the storage of some attributes.  Formerly, properties on a persistent
>archetype object were stored as normal object attributes.  Now they are
>stored in an OOBtree referenced by an attribute named '__annotation__'.
>
>To make a long story short, the current implementation of
>historicalRevision in Zope's OFS/History.py calls oldstate() in
>ZODB/Connection.py.  The serializer then calls getState() in
>ZODB/serialize.py (class ObjectReader), which sets up an unpickler to
>handle persistent references by overriding _persistent_load(). 
>Unfortunately, when the _persistent_load subroutine comes across a
>persistent reference, it either loads the CURRENT referenced object
>from the ZODB (using the oid and ZODB/Connection.py's get()), or loads the
>CURRENT referenced object from cache.  It does not take 'tid' into account
>when it loads persistent references.
>
>In order for Zope's "history" tab to work for anything other than a very
>simple object (with no persistent references), it needs to "deeply" copy
>objects out of the ZODB.  In other words, the persistent references we
>pull back for a historical revision of an object should be from the same
>'tid' as the original object.

A long time ago, I posted code (I think to "zope-dev@zope.org")
that does it for you in the right way.
It defines a "HistoricalConnection" which retrieves objects
with a state as of a given time.
You might search for "historicalRevision" and "HistoryJar"
to locate the post.


Zope 2.8/ZODB 3.4 broke my implementation but it would probably
not too difficult to get fixed.

-- 
Dieter
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to