See my comments below: Fran wrote: > On Jan 15, 7:10 am, LB22 <latn.bl...@googlemail.com> wrote: > > <snip/> > Session variables don't get stored within the DB, but purely with the > session global variable. > That's not totally correct. Sessions are (by default) stored in web2py/applications/appname/sessions/... as files. They are pickled Python Session objects. You can store these in a database instead of files using the session.connect(db=SQLDB(<connectstringhere>)) command. This has the advantage of better concurrency (with the exception of SQLite which has worse concurrency).
But if you don't use the session.connect command at all, web2py will just use files for you and all will be ok. The only thing I store in my session is identity information... session.userid = "351001" session.username = "bob" session.ip = "192.168.0.26" Once you set those options, you should always be able to refer to them in your code (as long as the user doesn't delete his/her cookies). > You can set options in your Controllers, e.g.: > session.flash=T('Not Authorised!') > > These then get interpreted in your views, e.g.: > {{if session.s3.debug:}} > > I extend the session to read options from the database by having this > in my model: > def shn_sessions(f): > " Extend session to support extra variables " > session.s3.debug=db().select(db.s3_setting.debug)[0].debug > return f() > response._caller=lambda f: shn_sessions(f) > Now that's kinda cool. Fran you should put that on the wiki. > Hope this helps :) > =) > F > > > -- Timothy Farrell <tfarr...@swgen.com> Computer Guy Statewide General Insurance Agency (www.swgen.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---