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