As an initial easy fix, we can hook some javascript up to the button to disable it after it has been clicked once.
It is tricky to handle this issue in the database, because there's an inherent race. The transactions will almost always overlap.
There are two approaches I can suggest to handle this.
1. Have a database that is not tied into the same transactions as the main database, so we don't get that same race. A special ZODB would serve for this. We generate a unique form-submission id when we render a form, when we receive the submission, store this in the special database, and on receiving a form submission, check that we don't have that id in the database already. We don't need to keep the data for very long, so a temporary data store is okay. It has to run outside of our normal transactions so that we can use it to detect these potentially overlapping transactions.
2. Make the object publisher sensitive to when the client has dropped the connection. When you click the same button twice, before you've received a response, your browser will usually drop the first connection and make a second connection. I don't know if we can get this information once the request has been proxied through apache, though.
As an initial easy fix, we can hook some javascript up to the button to disable it after it has been clicked once.
It is tricky to handle this issue in the database, because there's an inherent race. The transactions will almost always overlap.
There are two approaches I can suggest to handle this.
1. Have a database that is not tied into the same transactions as the main database, so we don't get that same race. A special ZODB would serve for this. We generate a unique form-submission id when we render a form, when we receive the submission, store this in the special database, and on receiving a form submission, check that we don't have that id in the database already. We don't need to keep the data for very long, so a temporary data store is okay. It has to run outside of our normal transactions so that we can use it to detect these potentially overlapping transactions.
2. Make the object publisher sensitive to when the client has dropped the connection. When you click the same button twice, before you've received a response, your browser will usually drop the first connection and make a second connection. I don't know if we can get this information once the request has been proxied through apache, though.