[ZODB-Dev] understanding _p_resolveConflict
Stefan H. Holek
stefan at epy.co.at
Wed Aug 4 06:27:56 EDT 2004
<http://mail.zope.org/pipermail/zodb-dev/2003-October/006133.html>
Note that it is not about selecting one of the states to return, but
about actually computing a new state (e.g. by merging savedState and
newState).
Stefan
On Mittwoch, Aug 4, 2004, at 08:19 Europe/Vienna, Bakhtiar A Hamid
wrote:
> say i have
> class myclass:
> def __init__(self,var1='',var2=[]):
> self.var1=var1
> self.var2 = var2
>
> def _p_resolveConflict(self,oldstate,savedstate,newstate):
> return newstate
>
> the code seems to work since i no longer got massive ConflictError.
> now
> there's some ReadConflictError (which is ok, i guess)
>
> my understanding/questions:
> -oldstate, savedstate and newstate are dicts. it's not REQUESTS
> -what do we need to compare/merge? say i'm interested with var2. and
> do
> something like this:
>
> def _p_resolveConflict(self,oldstate,savedstate,newstate):
> import difflib
> #difflib.unified_diff(savedstate['var1'],newstate['var1'])
> #if no diff, use oldstate
> #else use newstate
> return xxx #where xxx is what?
> -what do i return? the state i want?
>
--
The time has come to start talking about whether the emperor is as well
dressed as we are supposed to think he is. /Pete McBreen/
More information about the ZODB-Dev
mailing list