Handling states with HTTP
Fred Murray
vxg49 at yahoo.com
Wed Dec 17 22:31:56 EST 2003
Hi all,
I've been looking around for a utility that will let me do something like this:
while 1:
# Ask user for username and password
username, password = user_session.form_input(LOGIN_SCREEN)
# If username is invalid, warn user and ask again
if username not in users:
user_session.print(INVALID_USERNAME)
continue
# If password is invalid, warn user and ask again
if users[username] != password:
user_session.print(INVALID_PASSWORD)
continue
# If username and password match, then break out of loop
break
# (code to log in user goes here...)
In other words, I'm looking for a package that will use cookies or CGI
variables to save the state of the program in between HTTP requests. Packages
like Albatross seem to require class definitions for each page, which isn't
as natural or convenient as treating an HTML form as an input function (like
raw_input()).
If anyone knows if anything like this is available, thanks for letting me know!
More information about the Python-list
mailing list