Session with sub-applications problem

8 views
Skip to first unread message

Alva Yi

unread,
Dec 6, 2008, 6:20:53 AM12/6/08
to we...@googlegroups.com
session support in webpy0.3 is a big highlight,is there any one give a
example to show how to use session for sharing infomaion during
sub-applications?I have tried a lot, and i just can't get it work!

vulcan

unread,
Dec 7, 2008, 12:45:43 AM12/7/08
to web.py
Here is the solution:
initialize Session in code.py and attach it to the web namespace, then
can use it in every subapplications
e.g.
session = web.session.Session(app, web.session.DiskStore('sessions'))
web.ses = session

paul jobs

unread,
Dec 7, 2008, 4:54:57 PM12/7/08
to we...@googlegroups.com
does every subapp get a different session or the same shared session?

Alva Yi

unread,
Dec 8, 2008, 11:50:36 PM12/8/08
to we...@googlegroups.com
To paul jobs:
Of course not, you just and only can initialize in the code.py, code.py is where the main application is, and then use this instance in each subapplication, if you get different session in each application, you cann't share the information you stored in it., and where you shared is actually the session ID, not the variable you stored in the session scope.

2008/12/8 paul jobs <webj...@gmail.com>

paul jobs

unread,
Dec 9, 2008, 2:01:38 PM12/9/08
to we...@googlegroups.com
so how do we
prepare a separate session for each sub-application?
thanks
Reply all
Reply to author
Forward
0 new messages