views:

44

answers:

2

Hi All,

is there any class to handle a SESSION (like php) in Python? not in django, but I want to use it with PyQt

thank you

A: 

The short answer is that there is no $SESSION variable in Python.

Python tends not to put things in global scope like PHP. Therefore, if you are accessing a user's session id, it will probably be accessed via dot notation module_name.Class_name.session. If you would like to create a PyQt app that acts as a webserver, you could probably adapt a web framework's implementation.

Others' responses to similar queries suggest implementing sessions via a simple database[1]. You could try assigning unique ids with uuid, and storing them with tools like sqlite3 or pickle.

[1] http://ubuntuforums.org/showthread.php?t=859645

Tim McNamara
A: 

Theres a session class with mod_python for apache, that can be a good starting point for making our own class. The class is not very dependent on apache to work.

http://www.modpython.org/

Kent