I had this issue when I started with web.py, and I was completely new to Python too.
Right or wrong, here's what I did. I moved on because it worked. 1) I created a file called sharedsession.py It's one line - looks like this: - session = None 2) in my main web.py file I do this: - import sharedsession - ... - sharedsession.session = web.session.Session(app, web.session.ShelfStore(shelve.open('session.shelf'))) (I'm using shelf because I was having problems with the other type and wsgi/apache, and I don't wanna use a db.) Then, in all my other modules I "import sharedsession" and just reference 'session' there. Like I said, I'm no python expert, in fact I still don't fully understand "import" to this day. (It's like a black box for me... it works, it's magical in some ways, and I don't understand why.) If this is horribly wrong I hope someone else will warn you not to use my terrible idea. If it's right, you're welcome! ;-) On Wed, Aug 15, 2012 at 10:36 AM, Adam Bengtsson <adam...@gmail.com> wrote: > Hello agian, > > I was eager to try out the session functionality in web.py but am not > really sure how to go about doing this. Having consulted the cookbook I've > found the Working with Sessions-example. > > In this example, the app-object is passed as an argument to the session > initialization, and the session-object is then used globally by the other > classes _in this file_. > > How would I go about if I wanted to initialize or at least use a session > object in a different file where I no longer have the app-reference? Is > there some obscure reference to the current application somewhere within > the web-package? > > Thank you, > Adam > > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/webpy/-/GyuekdV6G9EJ. > To post to this group, send email to webpy@googlegroups.com. > To unsubscribe from this group, send email to > webpy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to webpy@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.