Re: Patch: HistoricalRevisions, atct_history support for annotation storage (used by newer ATCT)

Matt Hahnfeld <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.devel
Message-ID <[email protected]>
On Wed, 08 Mar 2006 23:35:21 +0000, Martin Aspeli wrote:

> Fantastic. I know limi is really keen on this coming back sooner rather  
> than later.
>
>> So, you think a monkey patch might be the way to go?
> 
> I'm unsure. I'd prefer it if the patch went into Zope. But you will have  
> to provide solid unit tests to convince people your patch isn't dangerous.  
> Take a look at http://plone.org/documentation/tutorial/testing (although  
> tests for Zope itself will probably have to use ZopeTestCase directly, not  
> PloneTestCase).
> 
> I'd like to hear from Jensens and possibly Alec Mitchell what they think,  
> though.

If this is going to go into Zope, which I think it should, we need to
find a more generic way to handle the issue.  The current patch is short
and simple, but it only handles __annotation__ attributes.  It provides a
very simple fix for the issue at hand (and actually works very well for
our needs!), but probably isn't something the Zope folks would want to add
to Zope.

The larger issue at hand is that the "oldstate" method in the zodb code is
flawed.  It works fine for very simple objects with attributes, but as
soon as there are any subobjects, it just pulls the newest revisions of
the subobjects.  Because subobjects are all stored and versioned
independently in ZODB, this problem could probably be fixed by simply
making sure we get versions of subobjects with the same serial number/tid
that was used to pull the base object.  Ideally we want this to happen for
*all* subobjects, not just our "__annotation__" OOBtree.

After following the code through its paces, I think I've found a single
line of code in Connection.py that is ultimately responsible for this
behavior. I think a better long-term solution could be accomplished by
patching a couple of the methods in ZODB/Connection.py and
ZODB/serialize.py.

I still need to do some additional testing, but I think I might have
something that will work. As soon as I test some things (and hopefully
write some unit tests per Martin's suggestion), I'll post a patch to the
list/tracker -- hopefully within a week or so.

Matt Hahnfeld
[email protected]



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.