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

Session CGI!

P: n/a
I need a web app framework in python with support for session
management (ala ASP/PHP). However, unlike some modules I found, I need
to integrate with an existing Apache install without opening any new
application server ports (not my server). Is there such a module which
I can just toss it into pythonpath and get to work?
Jul 18 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
jo*******@rediffmail.com (John) wrote in message news:<ba**************************@posting.google. com>...
I need a web app framework in python with support for session
management (ala ASP/PHP). However, unlike some modules I found, I need
to integrate with an existing Apache install without opening any new
application server ports (not my server). Is there such a module which
I can just toss it into pythonpath and get to work?


You could use cookies and/or database writes. Never been a big fan of
PHP sessions myself - they are basically temp files and GET variables
after all....
Jul 18 '05 #2

P: n/a
> You could use cookies and/or database writes.

Sadly that is what I want to avoid :-(
Jul 18 '05 #3

P: n/a
jo*******@rediffmail.com (John) wrote:
You could use cookies and/or database writes.


Sadly that is what I want to avoid :-(


Well, there isn't any magic avaiable, even in Python. Either you use a
port and an appserver or you store your session data somewhere. I'm not
sure what you were hoping to find.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #4

P: n/a
jo*******@rediffmail.com (John) writes:
You could use cookies and/or database writes.


Sadly that is what I want to avoid :-(


see here: http://www.catdancers.com/webmags/webtech/1998/03/perl/

it's about perl, but you can apply the idea to python too.

-- erno
Jul 18 '05 #5

P: n/a
Tim Roberts <ti**@probo.com> wrote in message news:<cr********************************@4ax.com>. ..
jo*******@rediffmail.com (John) wrote:
You could use cookies and/or database writes.


Sadly that is what I want to avoid :-(


Well, there isn't any magic avaiable, even in Python. Either you use a
port and an appserver or you store your session data somewhere. I'm not
sure what you were hoping to find.

I am not looking for magic. What I am looking for is an elegant
solution to manage session info like in ASP/PHP, both of which have
doing this for quite a while. It's hardly exotic. It has been a couple
of years since I last used ASP, but I think it was session("var") =
value in ASP. Can't be simpler than that. Similar stuff in PHP
session_register. It manages Client side Cookies under the hood. Nicer
if the session info is maintained as server side cookies with a unique
SessionID. At this point, I do not know if that can be done. Sessions
are important for me since the site is membership based.

All these nice and comprehensive Python web app framewoks I looked at
so far DO have session support but need additional ports to be open or
act their own servers. That's OK if you have your own machine for
server but my admin will think twice before he installs one of those
for my non-critical app. PHP does not seem to need that. But I prefer
Python if I can help it.

If I don't find quick 'n' easy session management, maybe I will at
least figure out common web app design patterns with cookies.
Jul 18 '05 #6

P: n/a
DH
John wrote:
I am not looking for magic. What I am looking for is an elegant
solution to manage session info like in ASP/PHP, both of which have
doing this for quite a while. It's hardly exotic. It has been a couple
of years since I last used ASP, but I think it was session("var") =
value in ASP. Can't be simpler than that. Similar stuff in PHP
session_register. It manages Client side Cookies under the hood. Nicer
if the session info is maintained as server side cookies with a unique
SessionID. At this point, I do not know if that can be done. Sessions
are important for me since the site is membership based.

All these nice and comprehensive Python web app framewoks I looked at
so far DO have session support but need additional ports to be open or
act their own servers.

You want session cookies stored as temp files instead of in a database.

To do it with Quixote see the session persistence section here and the
session_demo.cgi file included with Quixote:
http://www.mems-exchange.org/softwar...sion-mgmt.html

Spyce is a little more like ASP & PHP, see this doc, esp. the auto-
session handling part, which can work with or without cookies:
http://spyce.sourceforge.net/doc-mod_session.html
Jul 18 '05 #7

P: n/a
Erno Kuusela <er*******@erno.iki.fi> writes:
jo*******@rediffmail.com (John) writes:
You could use cookies and/or database writes.


Sadly that is what I want to avoid :-(


see here: http://www.catdancers.com/webmags/webtech/1998/03/perl/

it's about perl, but you can apply the idea to python too.

-- erno

There are two problems:

1. Where to store state. Databases, cookies, and pickle files are
available. I've used pickle files for low volume apps.

2. How to structure the CGI code. Of course, something like webware
or twisted would hide it all, but let's assume you are writing from
scratch. Since this is a stateless protocol, we can borrow from
another (and solved) stateless protocol -- sockets.

So for each webpage,we make 2 functions (or methods): send_xyz and
recv_xyz. On wakeup,we check a hidden field to determine which
"xyz" is arriving, and call its recv. There we use another hidden
field (or an SSL tag) to get the right database or pickle data and
load it into an object. Continue processing as if there was no
time gap. At end (ready for more user input), call the proper
"send". It prepares the hidden fields, saves the state, and prints
the outgoing page. The script exits and we are back at the
browser.

--
ha************@boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 342-0007
Jul 18 '05 #8

P: n/a
DH <no@sp.am> wrote in message news:<uf********************@comcast.com>...
You want session cookies stored as temp files instead of in a database.

To do it with Quixote see the session persistence section here and the
session_demo.cgi file included with Quixote:
http://www.mems-exchange.org/softwar...sion-mgmt.html

Spyce is a little more like ASP & PHP, see this doc, esp. the auto-
session handling part, which can work with or without cookies:
http://spyce.sourceforge.net/doc-mod_session.html


Hi DH,
I am looking at Quixote and Spyce. Both are very nice and fit my needs.

Thanks,
John.
Jul 18 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.