I just downloaded web2py, and I'm going through the html book for the first 
time.  I'm just getting to the point where I think I can understand the 
web2py approach, and I'm starting to get enthused.

I've gotten as far as the Postback section, and I'm running into problems. 
 The code does not seem to be working as posted, and I'm kind of at a loss.

Using the code below: 









def first():
    if request.vars.visitor_name:
        session.visitor_name = request.vars.visitor_name
        redirect(URL('second'))
    return dict()

def second():
    return dict()

 "default/first.html" view:







{{extend 'layout.html'}}
What is your name?
<form>
  <input name="visitor_name" />
  <input type="submit" />
</form>

 "default/second.html" view 



{{extend 'layout.html'}}
<h1>Hello {{=session.visitor_name or "anonymous"}}</h1>


(I first tried it slightly customized, then in frustration I copied and pasted 
verbatem without a change in results), it works as long as I actually input the 
visitor_name.  But if I don't input any value, then it does not display "Hello 
anonymous" as it should.  It just resets back to "first.html".

I went a little further, to the next step down, but I had similar problems 
there.  It doesn't seem to be treating null session data as it should.

So what should I try next?  I'll settle for any hint I can get.

*
*

Reply via email to