This looks very cool Ian, but I think I must be doing something wrong.
I tried the testapp and it worked just as expected, so then I tried to
use waitforit with pylons, so I made a new pylons app and added this to
my test.ini file:
[app:main]
use = config:development.ini
filter-with = slow
[filter:slow]
use=egg:waitforit
time_limit=2
poll_time=1
When I run the app with this controller:
class MainController(BaseController):
def long(self):
progress = request.environ.get('waitforit.progress', {})
start = time.time()
total = 10
count = 1
while time.time()-start <= total:
progress['message'] = 'hi joe you are at count %s' % count
count += 1
time.sleep(1)
return 'I was started at %s and it is now %s' % (start,
time.time())
and run main/long after about 2 seconds i get:
Please wait...
The page you have requested is taking a while to generate...
There is no pending request with the id None
And then nothing happends. After about 10 sec if I reload the page
myself I get the the correct page. Am I doing something worng?
Thanks inadvance
Jose
> -------- Original Message --------
> Subject: [Paste] ANN: WaitForIt
> From: Ian Bicking <[EMAIL PROTECTED]>
> Date: Sat, May 26, 2007 12:57 pm
> To: Python Paste Project <[email protected]>
>
> A new little mini-middleware: http://pythonpaste.org/waitforit/
>
> From the page:
>
> What It Does
>
> Wait For It gives users a timely response even when the underlying WSGI
> application isn't very timely. Wait For It does this by launching an
> extra thread for each incoming request. If the wrapped application
> responds in a timely manner (before time_limit) the response is simply
> passed on.
>
> If the response doesn't come back before the time limit, the user is
> given a response page that asks them to wait. The response page contains
> Javascript that will re-check the status of the page, and when the page
> is ready it will reload the page.
>
> Applications can provide feedback to users by looking for
> environ['waitforit.progress'] and putting information in there. In
> particular "message" contains an HTML message for the user (e.g., if you
> want to show what step the long-running application is working on).
> "percent" is used for a progress bar; it should be a number from 0 to
> 100. The value in progress is sent via JSON, so you should use only
> strings (preferably unicode), integers, floats, dictionaries (with
> string keys) and lists.
>
>
> --
> Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org
> | Write code, do good | http://topp.openplans.org/careers
>
> _______________________________________________
> Paste-users mailing list
> [email protected]
> http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users