Re: [Fwd: Re: Optimistic Locking]

Sebastien Bigaret <[email protected]> 01 Jul 2004 20:19:29 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
Ernesto Revilla <[email protected]> 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 has
> 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ébastien.



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com