On 21 Mag, 14:08, "Hermann Kaser" <[EMAIL PROTECTED]> wrote:
> On Wed, May 21, 2008 at 1:55 PM, Michele Petrazzo
>
> <[EMAIL PROTECTED]> wrote:
> > Yes, I'm using 0.3, but how can use yield?
>
> I mention yield because if I'm not mistaken, in 0.3, you can print
> stuff out as the script progresses rather than wait for script to
> finish. I suggest you try it out by writing a very basic function that
> yields text and sleeps for a couple seconds in between. I don't
> currently use 0.3 so I can't give you any working examples. Oh, and
> yeild is used just like print.
>

Just tried various code, but no output since the time time ends:

import time
import web

urls = ("/", "hello")

class hello:
    def GET(self):
        for i in xrange(3):
            yield "hello\n"
            time.sleep(1)

app = web.application(urls, globals()).run()

My browser "wait" 3 seconds and after show me the whole page.

Just thought that one of the "simpliest" way it's to save somewhere a
shared state, create an iframe (where show the progress) that reload
every n seconds. Create a "/internal_progress" page (class) that serve
the separate (iframe) page and return the state. When ends, show a
"goto" button into the iframe.

> Well, you'd need some way of the script you're running to report it's
> progress, be that a mysql table or a flat file. Then with some ajax
> you can poll for that information and echo it out. Once you know the
> script has finished you can forward the user. The JavaScript code is
> out of the scope of the mailing list and isn't exactly trivial, but
> there's a bunch of tutorials out there that can help you. Do a search
> for ajax progress bar and you'll see what I mean.
>

It's more or less my idea :) , only that I not use (or much less)
javascript.
I'll look at it!

Thanks,
Michele
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to