python - "lock" resource when user opens and unlocks when he finishes -



python - "lock" resource when user opens and unlocks when he finishes -

i using flask version 0.10.1 , python version 2.7.6

i have web application manages orders. let's have 3 orders:

order 1 order 2 order 3

there view

@main.route(/prder/<int:orderid>, methods=['get']) edit(orderid): pass

the view accesible registered users , have user object. let's have users user , user b.

when edits order 1 order should not editable user b.

i need mechanism "locks" order , order inaccessible edits when user working on order.

this "lock" need revoked when user finishes editing*

there scenario user closed browser or stopped working on order. not want order "locked" forever.

any ideas best way accomplish above functionality?

i've never used flask, sounds want mutex (example multi-threading here). behaviour should when b tries edit editing matter.

as not beingness locked forever, little more info required. "stopped working on order," mean idle time, or closed window? i'm pretty sure try...finally construction unlock mutex in event whatever within of try block prematurely terminated, i'm don't have plenty experience tell certain.

python flask

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -