And what if:

- there is no ajax
- the controller do the locking with controllable expiration
- form validation checks if there is a proper lock for the record
  - if not invalidate the submit
  - if there is a lock then update/delete/... the record and release
the lock

it could be done with crud internally...

On márc. 26, 15:42, mdipierro <mdipie...@cs.depaul.edu> wrote:
> It requires exposing an ajax listener. It would introduce a dependency
> on a js library and would be more complex for the user who would have
> to implement the listener.
>
> Massimo
>
> On Mar 26, 9:20 am, szimszon <szims...@gmail.com> wrote:
>
>
>
> > Seems to work. Thank you!
>
> > Anyway I think in long term it would be better to have such feature
> > integrated in core web2py.
>
> > On márc. 26, 03:04, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > No... that  did not work. This does:
>
> > >http://web2py.com/plugins/default/locking
>
> > > On Mar 25, 5:20 pm, Massimo Di Pierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > 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 notlock:
> > > >     # record was locked
> > > >     redirect(....)
> > > > else:
> > > >     #lockacquired
> > > >     return dict(...,lock=lock)
>
> > > > 3) and in page view:
>
> > > >     {{=lock}}
>
> > > > will insert the JS that will renew thelockas long as the page is open
>
> > > > Thelockwill 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
>
> > > >  web2py.plugin.locking.w2p
> > > > 1KViewDownload

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

Reply via email to