I am trying to make an AJax progress bar that is updated as a separate
process(thread) runs.  Eventually I plan to make my own widget for
this.  And yes, I know something similar exists.

My problem is that I am trying to store the progress in a session
variable so each user has their own particular progress.  Later on I
will probably expand this in case the same user has multiple progress
bars...

The problem I am having is that cherrypy does not see the updates to
the 'progress' variable in the session.  Here is my sample controller:

import cherrypy
import thread

class MyController:

   @expose(format='json')
   def getProgress(self):
       progress = cherrypy.session.get('progress')
       return dict(progress=progress)

   def _doSomething(self, arg):
       progressIncrement = 100/arg
       cherrypy.session['progress'] =
cherrypy.session.get('progress',0)
       for i in range(arg):
           time.sleep(1)
           cherrypy.session['progress'] +=progressIncrement

   @expose()
   def progressPage(self):
       thread.start_new_thread(self._doSomething, (10,))
       return dict()

I'll provide the JS if asked.

-percious


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to