using shelve module to create web databases....problems?

PiedmontBiz piedmontbiz at aol.com
Sun Jun 13 23:16:58 CEST 2004


I am finishing up a simple survey for a web site.
I am creating a server-side data base using the shelve module.
I am a relative python newcomer.
I began with anydbm, but found that shelve uses anydbm and pickle so it is a
bit easier for me to do what I want.

The database I am testing list 4 candidates for president.
A web form ( I use javascript to validate the data before sending it on ) posts
the users survey data to a server-side python program which simply entesr the
data into the database.
The user can then go to another page to see the cumulative results of the
survey. This is generated by another python cgi program.
This all works fine on my home system with Apache and Python 2.3(Win 2k)

Question.
Do I need to worry about contention for the single database file if more than
one user is trying to post his/her vote?
If so, should I write a routine which randomly waits a while then retries the
write?
How do I write the exceptions to control this?

Allen



More information about the Python-list mailing list