logo       

Re: conflict resolution for PersistentList: msg#00103

web.zope.zodb

Subject: Re: conflict resolution for PersistentList

Diez B. Roggisch wrote at 2004-5-21 13:22 +0200:
>after finding that my ConflictError was suppressed by a bad designed exception
>handler, I now want to implement a _p_resolveConflict method.
>
>I implemented it, but can't work with the passed state. It looks like this:
>
>>>> print oldState
>{'items': PR(1079757676 ('\x00\x00\x00\x00\x00\x00\x00\x02', <class
>'persistent.list.PersistentList'>)), 'name': 'father'}
>
>
>I want to iterate over the items-lists and merge them properly. However, I
>can't access the items as list - its not iterable.

The "states" handled by "_p_resolveConflict" are
the pickles for your objects are stored by the ZODB storage.
Usually, they are dicts with the object attributes.

Note that persistent subobjects are represented by
PersistentReferences (the "PR" above). These are *NOT*
the subobjects themselves but just references.
You cannot access the subobjects themselves during
conflict resolution.


That said, to resolve conflicts in "PersistentList",
you must give "PersistentList" a "_p_resolveConflict".
Your conflict resolution is one level too high (above
"PersistentList").

--
Dieter

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

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



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise