Thanks a lot. It works
On 8 Paź, 17:07, JGAllen23 <[EMAIL PROTECTED]> wrote: > I found a work around, although I'm not sure if this is the right way > to do it. > > I have a session init like this: > session = web.session.Session(app, web.session.DiskStore('sessions'), > initializer = {'test': 'woot'}) > > I created a processor via web.loadhook > def session_hook(): > web.ctx.session = session > > app.add_processor(web.loadhook(session_hook)) > > this gave me access to the session via web.ctx.session over all of my > sub apps > > Thoughts? > JGA > > JGAllen23 wrote: > > I'm having the same issue. Session works great in my main app, but if > > I try to use main.session, it returns an empty storage session. I did > > get it to work if in my main.py I did something like: > > > subapp.session = session > > > then my subapp could see the session variables. > > > pigmej wrote: > > > Maybe but it's not work for me... > > > > ####sesje.py > > > > import web,sesje2 > > > > urls = ( > > > "/count", "count", > > > "/reset", "reset", > > > '/test',sesje2.sesje2app, > > > ) > > > app = web.application(urls, globals()) > > > > session = web.session.Session(app, web.session.DiskStore('sessions'), > > > initializer={'count': 0}) > > > > class count: > > > def GET(self): > > > session.count += 1 > > > return str(session.count) > > > > class reset: > > > def GET(self): > > > session.kill() > > > return "" > > > > if __name__ == "__main__": > > > app.run() > > > > ####sesje2.py > > > > import web > > > > urls = ( > > > '/count','count', > > > '/reset','reset', > > > ) > > > sesje2app = web.application(urls, locals()) > > > > def get_session(): > > > import sesje > > > return sesje.session > > > > class count: > > > def GET(self): > > > get_session().count += 1 > > > return str(get_session().count) > > > > class reset: > > > def GET(self): > > > get_session().kill() > > > return "" > > > > This is modified example from cookbook. In sesja everything works. In > > > sesja2 nothing... > > > If i visithttp://localhost:8080/test/countit raises: AttributeError: > > > 'count' > > > > How to fix it ? > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/webpy?hl=en -~----------~----~----~----~------~----~------~--~---