Im trying to make a progress bar by reading and writing a session variable:

There are 2 controllers:
Get session.progress
def getprogress():
    print "getprogress:", session.progress
    return session.progress

This one takes 5 seconds to perform and changes session.progress each one.
def progress():
    # when a form is submitted, change progress each second
    if request.post_vars:
        for i in range(5):
            session.progress = i
            print "main:", session.progress
            sleep(1)
        return "done"
    else:
        session.progress = -1
    return locals()

At the view, there are two ajax calls. One that triggers "getprogress" each 
second, and another one that triggers "progress" when a random form is 
submitted.

at the browser's console, getprogress only returns -1

at the python console i get a log like this:
getprogress: -1
getprogress: -1
main: 0
getprogress: -1
main: 1
getprogress: -1
main: 2
getprogress: -1
main: 3
getprogress: -1
main: 4
getprogress: -1

getprogress should be changing since im writing the session variable.

If im changing a session variable in a controller why hasnt changed when i 
ask for it on another one?

Should i be using cron jobs or threads to make a progress bar?

Thank you very much.

-- 
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