On Jun 6, 4:45 am, João Ventura <joaojonesvent...@gmail.com> wrote: > Hello mdipierro, > > i only store basic python datatypes (dictionaries, floats, strings). > The most complex variables that i store are dictionaries inside other > dictionaries, with a max depth of 2 (i.e., a first dictionary with > secondary dictionaries inside it). > It is a bit strange for, while using the same client browser on the > same app instance (i.e., without reloading), after a while web2py > ignores the first session file and creates a second one. In other > words, in what situations is web2py designed to do this behavior?
No. web2py reuses the same sessions for the same client over and over, unless it fails to retrieve a session. Try print request.cookies. It may help figure it out. > Also, are there any kind of methods for clearing the session files? You can have the app itself clear them or you can use a cron script like admin/cron/expire_sessions.py > Because with this kind of behavior, one gets the session folder filled > up very fast.. Is there any possibilty of session timeout and file > deletion? move admin/cron/expire_sessions.py into your app cron > Ah, this has already happened before, and the only common thing that > i've detected so far is that i use tab navigation with jquery's ajax > function to load content to a div. Any hints? I do not understand. Sorry. > Thanks, > João Ventura > > PS: I'll try to debug my application down to the web2py source code to > see if something triggers my thought. Any ideia where to start > searching? > By the way, web2py is a great framework, i've started with Django, > couldn't do almost no production there, switch to web2py, and > production increased a lot... Just this annoying session behavior, but > hope it's a small bug.. > > On 6 Jun, 06:36, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > The only thing that comes to mind is if you try store an object in the > > session. The object may be an instance of class that you define and > > therefore web2py succeeds in storing the session but fails to retrieve > > it because the class is not yet defined (or imported) at the time when > > the session is retrieved (before your user code it executed). > > > You can only store primitive types in session, not objects. > > > On Jun 5, 9:04 pm, João Ventura <joaojonesvent...@gmail.com> wrote: > > > > Hello everyone, > > > > i've searched a lot but couldn't find any answer to the following: I'm > > > developing a web application, and i rely heavily on sessions, storing > > > all the user data on a session while the user uses a jquery tab > > > interface. The problem is that sometimes web2py loses the session > > > object, and it is almost in the same manner. I've checked my code many > > > times and i don't mess with the session object. > > > > But as web2py does manage sessions automatically, i see that the first > > > time i use the app, web2py creates a session file in the session > > > folder. And when the contents of the first session disappears, when i > > > check the "sessions" folder, the previous session file is there with > > > all its contents, but now there's a new (empty) session file. > > > > I can't give a simple example how to replicate the error, but i think > > > web2py shouldn't lose the first session, because: > > > - I haven't explicitely called anything like "session.forget()" that > > > could influence. > > > - I haven't opened any other browser instance, tab or any other > > > browser at all. > > > > Anybody knows anything about this? > > > > Thanks, > > > João Ventura