Tracking Sessions in a Python CGI app.

Tim Roberts timr at probo.com
Fri Sep 5 00:44:16 EDT 2003


"Andrew Chalk" <achalk at XXXmagnacartasoftware.com> wrote:
>
>Is there a unique session ID created in a Python CGI app.?

No.  Each transaction in a web server is separate.  There is no concept of
"sessions".

>If not, and I suspect not, what is the best way to keep track of the session
>that loads each web page? I need to store form data from multiple forms
>completed by the user. What is the best way to keep track of which user is
>which?

One common way is to generate a random number as a session ID and send it
to the client as a cookie.  Another way is to embed the session ID in a
<input type=hidden> field, but then you have to remember to carry that
forward in ALL the forms.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.




More information about the Python-list mailing list