Let's start with your database query... it should not be in your view.
That will help...
What you do it you can have a page that is queried with .load (it's ajax
jquery stuff)... it will query a page for you every second or so if you
use the right kind of js.
When the page your looking at every second or so is loaded it will do
one of two this... display nothing... or display a javascript with a
javascript redirect in it to your new location.
It's a cheap way to do it but it works.
The way yours is setup there is not confirmed time when it will be done
and eventually your browser will eventually give up. (The page didn't
load, timeout error, or something like that.)
Perhaps this approach would be better.
BR,
Jason Brower

On Wed, 2010-10-20 at 10:41 -0700, meland wrote: 

> Hi Jason,
> 
> Thank you for your reply.  I think I have tried something similar to
> your suggestion.
> 
> The user clicks a link to advance to the wait page from a page I'll
> call first page...
> 
> {{extend 'layout.html'}}
> <h3>You are playing as a responder in this game...</h3>
> <ul>
>   <li>{{=A(B(T("Click to enter game")), _href=URL('responder_waits'))}}
> </li>
> </ul>
> 
> Then, the code on the wait page queries the database until a
> confirmation value is found to be True
> 
> {{extend 'layout.html'}}
> <h3>Waiting for a proposal... please be patient</h3>
> 
> {{import time}}
> {{confirmed = False}}
> 
> {{while not confirmed:}}
> {{confirmed = db.games[session.game_id].proposal_confirmed}}
> {{time.sleep(0.5)}}
> {{pass}}
> 
> {{redirect(URL('responder_responds'))}}
> 
> The corresponding controller function is simply...
> 
> def responder_waits():
>     return dict()
> 
> The problem: the wait page is not displayed.  Rather, from a user's
> perspective they are left at the first page and never see the wait
> page. Once the database query completes they are taken to
> responder_responds.  This is troublesome because if the user clicks
> the link (on the first page) a second time then my application hangs.
> Can you explain why the content of the wait page is not displayed for
> the user?
> 
> Cheers... Mike
> 
> On Oct 19, 10:27 pm, Jason Brower <encomp...@gmail.com> wrote:
> > I have had similar problem. Here is what you could do. Dont think about the 
> > page you click on but where you are redirecting. Get or post the parameters 
> > you want into the next page that is telling you to wait. Then on the 
> > "telling you to wait" page you take the parameters and start looking. As 
> > long as it isnt too long this should get you by pretty well. On my phone so 
> > bad typing, but i think you get it.
> > BR,
> > Jason
> >
> >
> >
> > ----- Original message -----
> > > Hello Group...
> >
> > > I'm both new to web2py and web programming... but I have been learning
> > > web2py for a couple months now.
> >
> > > The scenario I'm trying to implement server-side is as follows...
> >
> > > A user "A" clicks a link and the corresponding function 1) initiates a
> > > database poll that may take a few seconds or so to complete; 2)
> > > simultaneously presents user "A" with a link-free page asking them to
> > > wait; 3) when the database poll has completed - checking to see that a
> > > value has been posted by user "B" - user "A" is redirected from the
> > > wait page to another URL.
> >
> > > I'm stuck with this.   I've tried coding this different ways, but what
> > > typically happens is that the wait page does not display until after
> > > the polling operation has completed and the user is not redirected to
> > > the new URL.   I have read over the intro and core sections of the book
> > > regarding processing flow, but I'm still not sure how to solve this
> > > issue.   In need of some some direction :)
> >
> > > Cheers.


Reply via email to