Re: [Fwd: Re: [Modeling-users] Optimistic Locking]
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2004-07-01 18:21:04
|
Ernesto Revilla <er...@si...> wrote: > Thanx a lot for your comments. (Perhaps some sentences could go into the > documentation?) Yes, probably ;) The discussion we have on the ml is often a first draft for the real documentation! > The first thing: is there an easy way to use all attributes of an object = for > optimistic locking? Sorry, no, but you can ask for one in PyModels! > On the other hand, how can I easily simulate optimistic locking collisions > within the same process? (suppose you use ZOPE which has just one process, > but different EditingContext, and want the user to be warned, when data h= as > been updated by another user?) Okay, this does not really "simulate" optimistic locking collisions, since if a process hits a conflict you'll get an exception when saveChanges() is triggered, however within a single process different threads/ECs are notified when an EC saves its changes. This notification is EditingContextDidSaveChangesNotification, which by default triggers EditingContext.mergeChanges (which applies the changes, then re-applies its own changes). After a quick check, I realize that most of the code is there around on my computer, but I haven't committed it to CVS nor to a branch. I do not have the time to check this, nor to start to have a look again at it by now. However, if you wish, I can post the full patch for the code I have here. And naturally and again, if you need optimistic locking, then loudly ask for it!! Cheers, -- S=E9bastien. |