You can use *global variables, sessions, session._initializer *and 
conditions as* if..else*. For example:
In your app.py you should create:

store = web.session.DBStore('database','table_users') 
> session = web.session.Session(app, store, initializer={'login': 0, 
> 'username': 'default' })
> session_data = session._initializer 

  

# This is a basic example
> # This is only the class login without the render and other variables that 
> you need
>
 

class login:

 


>     def GET(self):
>         if session_data['login'] == 1:
>             raise web.seeother('/profile')
>         else:
>             return render.login()


>     def POST(self):
>         i = web.input()
>         m = model.login(i.user, i.pass) # model.py is the conection to db 
> that return True or False
>         if m:
>             session_data['login'] = 1
>             session_data['username'] = i.user
>             raise web.seeother('/profile')
>         else:
>             session.login = 0
>             return render.login(msg="User or password incorrect")


If you want more information in http://webpy.org/cookbook/ there simple 
examples that you can use for your web app

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to webpy+unsubscr...@googlegroups.com.
To post to this group, send email to webpy@googlegroups.com.
Visit this group at http://groups.google.com/group/webpy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


  • [webpy] webpy CEBILE ELLEN SKHOSANA
    • [webpy] Re: webpy Faustino Aguilar Quirós

Reply via email to