On 2007-09-06 Jose Galvez wrote: > I am looking for a way to "lock" a webpage so that only only > one person at a time can edit database data. Here is the > scenario, I have a database with a limited number of users who > have write access to the database, what I'd like to do is lock > the editing page so that if one of my users is editing a page > then the other users will not be able to edit the same > page(data) at the same time.
You could look at the model the MoinMoin wiki uses (and probably most wikis). Basically, don't use the database to enforce the edit locking, but rather set an application global "lock and timer" on a page being edited that expires after some minutes (and make the user aware of it). Then when the time expires, warn the editor that he just lost his lock and will lose his changes permanently (or cause conflict) if he doesn't save/renew ASAP. Meanwhile, other would-be editors receive a "page being edited, try again in a few minutes, or deal with conflict" message when they try to edit the locked page. As soon as the lock expires you have a race between editors to try and obtain the lock. You could make it more robust with some rotation/priority protocol, but simple is probably better for human page editing. -- _ _ ___ |V|icah |- lliott " " """ [EMAIL PROTECTED] <>< http://MicahElliott.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---