Hi all, First thanks for the suggestions, after reading what has been posted and giving it more thought this is how I think I am going to handle "page locking".
1) when a user enters the page to edit it, I will create a "lock" in a lock table in my database. This way of someone else whats to edit the same page I can tell them that it is being edited by someone else and just let them view the data as readonly 2) I will use some javascript to keep track of the person doing the edits. I am going to use window.onload to start a "reminder timer" giving the user say 30 min to do their edits. after the 30 min I will open a dialog which will launch yet another timer. one - if the user ignores the reminder after say 5 min it will reload the page and trigger some cleanup (see 3 below). If the user is not done, closing the dialog will cancel this timed event and let the user keep editing the page 3) I am going to use window.onbeforeunload to find out when a user has left the editing page, and fire an ajax call to clean up the database locks. I've not actually written all the locking code yet just been playing with the timers and onbeforeunload and I think it will work. I'll post some working code if it works or let you all know if it does not work Any dialog about this or other approaches would be great. Jose On Sep 6, 1:07 pm, "Jose Galvez" <[EMAIL PROTECTED]> wrote: > Hi all, I'm hunting for advice. 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. I know that this is what > transactions are for in a database, but what I want to avoid is two people > looking at the same unedited data and then editing it. I guess what I > really want to is lock a database when I use starts editing the data. The > issues are: > 1) How to make sure someone exits the edit mode nicely? what happens if they > enter the edit page, do nothing and just close the browser, I don't what to > leave the table locked > 2) if the table is locked I would still like to let users view the data in > real time, jut not edit it. > > I've used a "lock" table for this in the past, but the issue that I've never > figured out is how to make sure someone still needs the lock. Again number > (1) from above. > > I hope that this makes sense, I'll be using sqlalchemy and postgres on the > back end > > thanks for any and all advice > jose --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
