|
Re: conflict resolution for PersistentList: msg#00109web.zope.zodb
On Fri, 2004-05-21 at 07:22, Diez B. Roggisch wrote: > 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 examples I found on > the net only deal witht simple integer data fields. What do I have to do to > access the state as real objects? Is there a deserialization neccessary? As a general rule, you need to include all the information needed to resolve conflicts in a single database record. If the class represented by old state has a resolvable conflict that depends on the values in items, then you would need to design an object that does not use a separate PersistentList for items. This necessarily makes your design more complicated, but you're optimizing performance. Are you sure that the conflicts you care about are in this parent object? Without knowing anything about your application logic, I would guess that items is modified more often than its parent. If so, you need an _p_resolveConflict() method on items, not on the parent. You could accomplish that by subclassing PersistentList and adding the _p_resolveConflict method. Jeremy _______________________________________________ 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> |
|---|---|---|
| Previous by Date: | RE: conflict resolution for PersistentList: 00109, Jeremy Hylton |
|---|---|
| Next by Date: | Re: conflict resolution for PersistentList: 00109, Diez B. Roggisch |
| Previous by Thread: | Re: conflict resolution for PersistentListi: 00109, Dieter Maurer |
| Next by Thread: | Re: conflict resolution for PersistentList: 00109, Diez B. Roggisch |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |