By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,828 Members | 1,862 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,828 IT Pros & Developers. It's quick & easy.

Working Python Cookies code.

P: n/a
Greetings

I am working on web site (class project) which has a personality assessment
survey section. I originally wrote a standalone program in RapidQ basic. I
decided to rewrite the program for the web using python. I use Javascript on
the client side and two python scripts on the back side.

Problem. It would have been very easy (I think) if I could have gotten my
python script to read and write cookies . I am a newbie to python. I am not
able to make any of the code snippets work. I have tried.

the examples in the python23 documentation (cute code but useless to me)
ug's Python CGI scripts: cookie.py (compiler balks, throws exceptions)
Danny Yoo's script hkn.eecs.berkeley.edu/~dyoo/python/cookiecounter.py

I finally got it to work by just using javascript to call the script and pass
the form
eg. ( http://www.expectedend.com/cgi-bin/g...uestionNum=123)

this works, but the final screen of the program -- 110 python-generated pages
total-- contains a key value 110 characters long.

example session:
"http://www.expectedend.com/cgi-bin/testresults.py?SG=31234210123324213133
21401341031331234101233123143104321000011222222222 222233333333333333344444
444443333400030249"

I suppose a user might be concerned to see this large url in his/her address
window.

Does anyone have a working cookie snippet which would only use standard Python
2.3+ libraries and not require anychanges to Apache or any binary dependencies?

Or, is my solution good enough.

Thanks in advance.
Allen
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.