a problem with concurrency

Michele Simionato michele.simionato at gmail.com
Fri Jun 5 15:08:46 CEST 2009


On Fri, Jun 5, 2009 at 2:59 PM, Tim Chase <python.list at tim.thechases.com> wrote:
> The common way to do this is to not bother with the "somebody else is
> editing this record" because it's nearly impossible with the stateless web
> to determine when somebody has stopped browsing a web page.  Instead, each
> record simply has a "last modified on $TIMESTAMP by $USERID" pair of field.
>  When you read the record to display to the user, you stash these values
> into the page as $EXPECTED_TIMESTAMP and $EXPECTED_USERID.  If, when the
> user tries to save the record, your web-server app updates the record only
> if the timestamp+username+rowid match

This is much easier to implement than the locking mechanism since I already have
the fields $EXPECTED_TIMESTAMP and $EXPECTED_USERID in the db!
It looks quite sufficient for my use case.



More information about the Python-list mailing list