@auth.requires_login()
def index():
   return dict(message=T('Hello World'))

2011/4/5 黄祥 <steve.van.chris...@gmail.com>

> hi,
>
> i want to use condition that if user not log in will redirect to login
> page, and if logged in will redirect to index page, heres my
> controller :
>
> if not session.authorized:
>        redirect(URL('user'))
> else:
>        redirect(URL('index'))
>
> def index():
>    return dict(message=T('Hello World'))
>
> def user():
>    return dict(form = auth())
>
> i know there is a mistook code on my own, could there anybody show me
> where is the wrong part?
> i've tried the other code too, but got the same result :
>
> if not auth.is_logged_in():
>        redirect(URL('user'))
> else:
>        redirect(URL('index'))
>
> def index():
>    return dict(message=T('Hello World'))
>
> def user():
>    return dict(form = auth())
>
> thank you so much before




-- 
My blog: http://martin.tecnodoc.com.ar
Expert4Solution: http://www.experts4solutions.com/e4s/default/expert/6
http://www.cvstash.com/profile/Xzi5bWCdD

Reply via email to