Give this a try... it may need some debugging

1) install the plugin:

2) in the controller actions that need some locking

lock=plugin_locking('tablename',record_id)
if not lock:
   # record was locked
   redirect(....)
else:
   # lock acquired
   return dict(...,lock=lock)

3) and in page view:

   {{=lock}}

will insert the JS that will renew the lock as long as the page is open

The lock will be associated to the record_id of tablename and any other user trying to access any other page locking the same record will be unable to do so.

As a shortcut you can simply insert

{{=plugin_locking('tablename',record_id) or 'this record was locked by another user'}}

or

   {{=plugin_locking('tablename',record_id) or redirect('somehwre')}}



Massimo




Attachment: web2py.plugin.locking.w2p
Description: Binary data

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to