[Zope] using _p_resolveConflict on Folderish object

Stefan H. Holek stefan@epy.co.at
Sun, 29 Dec 2002 21:46:32 +0100 (CET)


On Sun, 29 Dec 2002, Willem Broekema wrote:
> Stefan H. Holek wrote:
> > To answer your question, savedState and newState are the ones competing
> > for "final" state. Do not get confused by the (badly chosen) parameter
> > names ;-). Your job is to resolve this conflict by e.g.
> >
> > intermediateState = merge(oldState, savedState)
> > finalState = merge(intermediateState, newState)
> > return finalState
>
> I understand that, in theory. :-)

Let me add that depending on your situation, *both* savedState and
newState may be "correct". If, say, the conflict is triggered by two
threads simultaneously adding new objects to your Folder, you will want
the final state to contain the subobjects from both these threads
(states).

> In practise, I saw that oldState and savedState were equal. I don't see
>   the conflict. Therefore, I don't know how to 'merge' the states.

There is no need to merge equal states.

> Can I assume there is no real conflict then, and return the newState?

Only if oldState == savedState == newState.

Stefan