Hi Jason,
Thanks for the reply. I think I have tried something similar to your
suggestion.
>From a first page click a link that directs to the wait 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>
The controller for responder_waits is simply...
def responder_waits():
return dict()
The view is...
{{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 problem: The user never sees the wait page. They are left on the
first page while the database is polled. After polling completes they
are brought to the responder_responds page. Can you explain why the
wait page does not display?
This is troublesome because if the user clicks the link on the first
page a second time then the application hangs.
Cheers... Mike
On Oct 19, 10:27 pm, Jason Brower <[email protected]> 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.