I was having this same problem and, from feed-back from the list, I changed the way I obtained my database connections. I used to simply get a cursor from a session stored connection. Now, I use a thread lock (I this it's called so):
: from threading import Lock :
class MySessionData ():
__init__ (self, ....):
:
:
self._conLock = Lock() def cursor (self, cClass = None):
self._conLock.acquire()
if cClass != None:
c = self.db.cursor(cClass)
else:
c = self.db.cursor()
self._conLock.release()
return cThis has been working very good for about a week, so I think it's the solution.
You say you're doing much more than simply database work, and you forward to a calculated page. I that case, I'd lock the calculation method (assuming it's short/fast enough):
self._conLock.acquire()
destination = self.calculations()
self._conLock.release()
returnHope this helps!
Ed.
David London wrote:
I'm running into what I'm told is a common problem, so I'm hoping that someone out there has a common solution.
My users are submitting the page multiple times.
Based on the user input and the state my code does a number of calculations. If I get the same input multiple times the data can become corrupted, which, of course, is a bad situation.
I did see a post previously that dealt with database access, but since I'm doing more than just that (and I have the pleasure of working with oracle) I was trying for a 'better' solution. I had already known that I couldn't rely upon javascript to solve my problem.
What I was thinking, is that since all of my calculations are done within the awake method of a single class (and then a particular page is chosen to forward to), I could just have a 'working' flag set and released in the awake method (and stored in the session) of this controller class. Setting and testing the flag works fine, but I am lacking some vital piece of knowledge because I now get blank pages. This is probably due to my calling self.endResponse() if the controller class receives a response while it is still processing.
I'm hoping that by now someone has a good idea of what the problem and solution is.
Is the solution something as simple storing the first response/transaction and then replacing the last response with the old one? Or am I going in the wrong direction?
I am really hoping that someone has a solution because I know that telling the users to 'only click once' is not going to work.
David London [EMAIL PROTECTED]
------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
-- Eduardo Elgueta Senior Consultant Navix
correo/email: [EMAIL PROTECTED] tel�fono/phone: +56 (2) 209-8905 celular/mobile: +56 (9) 821-0033 web: www.navix.cl
Av. Pedro de Valdivia 555 Of. 216 Providencia 7500913 Santiago, Chile
------------------------------------------------------- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
