PHP session equivalent?

Erik Johnson spam at nospam.org
Fri Feb 11 20:56:22 EST 2005


    There are a lot of things about PHP I was not too keen on and hence why
my company is primarily doing Python these days, but one thing I was quite
impressed with was the ease with which it provided session functionality...

<?php

    session_start();
    session_register['my_var'];

    $my_var = "whatever";

?>

    And then in another CGI script do basically the same thing and get the
value of $my_var back. Setting of a session ID cookie happens automagically.
This is quite handy and simple.

    I don't think it's quite so simple in Python (which is not to say I
think PHP is better than Python). Doing a little extra work is no big deal,
but could someone be so kind as to lay out what needs to be done for a
Python CGI script to get essentially the same functionality? Are there
Python modules that implement a lot of this already?

    We are currently running under an Apache server (on SuSE Linux 8.2). I'm
not clear on whether some session functionality is provided there? We may be
moving to Zope before too long (trying to find some time to evaluate it), so
a method that is not strictly dependent on Apache would be preferable (in
the short term that may suffice).

Thanks for taking the time to read my post! :)

-ej





More information about the Python-list mailing list