Try calling session.connect().

Anthony

On Monday, February 22, 2016 at 4:18:10 PM UTC-5, Dan wrote:
>
> I've hit another obstacle using *session.forget(response)...*
>
> In the same controller / function where I'm using this 
> session.forget(response) for the progress bar (ajax) to work properly, I 
> cannot use any session variables (since these are "forgotten" as per the 
> command above) ?!
>
> Is there a way to tell web2py to start "remembering" sessions again,  
> *after* I'm done with the progress bar (the lengthy process has finished, 
> there's no more need for the progress bar) - and now I'd like to use the 
> global nature of the session variables to pass data to other controllers.
>
> Any ideas ?
>
> Thanks
>
> On Sunday, February 21, 2016 at 9:14:52 PM UTC-5, Dan wrote:
>>
>> I am working on a progress bar and I have used the suggestion on this 
>> post to use *cache.ram* as the mechanism to update the client (via ajax 
>> call) while the controller (on the server) is still working.
>> Using cache makes sense, since a global variable defined in a model such 
>> as db.py cannot be updated in the controller in a timely fashion and a 
>> session variable is not useful until the controller has finished working - 
>> which kind of beats the purpose of a progress bar...
>>
>> I've noticed a strange behaviour and it took me a while to debug it:
>> If the controller that requires a progress bar has ANY session.variable 
>> defined, the progress bar will run the first time but not after that - 
>> unless sessions are cleared !
>>
>> The solution I found was described in a different post (by Anthony as 
>> well) - the need to declare in the controller:
>>
>> *session.forget(response)*
>>
>> *"session.forget(response)* *that will not only prevent the session from 
>> being saved, but it will also immediately unlock the session file. That 
>> could be useful if you will have multiple simultaneous requests coming from 
>> the same user/session (e.g., Ajax calls, or multiple browser tabs open) and 
>> don't want each request to have to wait for the previous one to complete. "*
>>
>> I will finalize the code the next days and will publish my "recipe" for a 
>> nice and easy progress bar, soon after.
>>
>> Thanks
>>
>>
>> On Wednesday, February 17, 2016 at 7:21:01 PM UTC-5, Alfonso Serra wrote:
>>>
>>> Omg it did work!. Thanks you very much Anthony, i owe you one.
>>>
>>> Console log:
>>> progress -1
>>> progress -1
>>> main: 0
>>> progress 0
>>> main: 1
>>> progress 1
>>> main: 2
>>> progress 2
>>> main: 3
>>> progress 3
>>> main: 4
>>> progress 4
>>>
>>>  
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to