[web2py] Re: second page to be accessed only from first page

2014-11-20 Thread T.R.Rajkumar
Thanks a lot Anthony. It'll be perfect. On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote: > > In book chapter 3 overview the following is given to restrict access to > second page. > > if not request.function=='first' and not session.visitor_name: > redirect(URL('first'

[web2py] Re: second page to be accessed only from first page

2014-11-19 Thread Anthony
request.function is always going to be the name of the function that has been requested -- that's what it is for. On each request, why don't you just do something like this in a model: session.last_page = session.this_page or None session.this_page = (request.controller, request.function) def r

[web2py] Re: second page to be accessed only from first page

2014-11-18 Thread T.R.Rajkumar
@Anthony Yes the session var is OK. But I would like to see that the second page can be visited only after the first page. Keeping the session var flags can be troublesome if we have hundreds of pages and the same session var gets set in some other page. Is their a way out? The request.function

[web2py] Re: second page to be accessed only from first page

2014-11-18 Thread Anthony
So what is the problem? It sounds like it is working as expected -- with the "not session.visitor_name" condition, you get a redirect if no name has previously been entered on the first page, correct? Are you observing something different? Note, once you have visited the first page, you can the

[web2py] Re: second page to be accessed only from first page

2014-11-17 Thread T.R.Rajkumar
I am able to visit the second page directly without visiting the first page if I have only the request.function. If I add the session var condition then it restricts. On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote: > > In book chapter 3 overview the following is given to

[web2py] Re: second page to be accessed only from first page

2014-11-17 Thread Cliff Kachinske
I believe the book is correct. Are you sure the redirect doesn't work? request.function should be "second" if that was the requested function. The redirect occurs after the request is parsed. On Saturday, November 15, 2014 4:58:15 AM UTC-5, T.R.Rajkumar wrote: > > In book chapter 3 overview the