Finally
def user():
"""
exposes:
http://..../[app]/default/user/login
http://..../[app]/default/user/logout
http://..../[app]/default/user/retrieve_password
http://..../[app]/default/user/change_password
http://..../[app]/default/user/not_authorized
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
form=auth()
if request.args(0) == 'login':
return dict(form=form,layout='login_layout.html')
else:
return dict(form=form,layout='layout.html')
if request.args[0] == 'profile':
return dict(form='you are not allowed
(permission)',layout='layout.html')
return dict(form=form,layout='layout.html')
and
user.html :
{{extend layout}}
{{=form}}
I was about to get there before I got you mail Massimo... [?]
Thanks all!
Richard
On Wed, Nov 24, 2010 at 5:35 PM, mdipierro <[email protected]> wrote:
> def user():
> layout=....
> form=auth()
> return dict(form=form,layout=layout)
>
> On Nov 24, 4:34 pm, Richard Vézina <[email protected]>
> wrote:
> > http://www.mail-archive.com/[email protected]/msg47106.html
> >
> > <http://www.mail-archive.com/[email protected]/msg47106.html>I
> read
> > this thread can't figure out I to do it.
> >
> > In {{extend layout}}
> > layout is a variable or a function?
> >
> > Richard
> >
> > On Wed, Nov 24, 2010 at 5:32 PM, mdipierro <[email protected]>
> wrote:
> > > Extend is hanndled by the preprocessor before the if is executed.
> >
> > > You can do
> >
> > > {{extend layout}}
> >
> > > and set the layout variable in the controller. This will not work if
> > > you bytecode compile it.
> >
> > > On Nov 24, 4:31 pm, Richard Vézina <[email protected]>
> > > wrote:
> > > > {{if request.args(0)=='login':}}
> > > > {{=P(0)}}
> > > > {{extend 'login_layout.html'}}
> > > > {{else:}}
> > > > {{=P(1)}}
> > > > {{extend 'layout.html'}}
> > > > {{pass}}
> >
> > > > {{=form}}
> >
> > > > It always take the second layout...
> >
> > > > Richard
> >
> > > > On Wed, Nov 24, 2010 at 5:25 PM, Albert Abril <
> [email protected]
> > > >wrote:
> >
> > > > > Or using auth.login() in your controller/view instead of auth().
> >
> > > > > On Wed, Nov 24, 2010 at 10:41 PM, Richard Vézina <
> > > > > [email protected]> wrote:
> >
> > > > >> Hello,
> >
> > > > >> Is there a way to have a particular layout for default/user/login
> that
> > > > >> will not affect ddefault/user/not_authorized for example?
> >
> > > > >> I try by adding a login.html in view without success.
> >
> > > > >> Thanks
> >
> > > > >> Richard
> >
> >
>
<<330.gif>>

