I gave it a try. I made three copies of the layout.html file, renamed
them user_x.html, user_y.html and user_z.html, and entered a fixed
title to be able to distinguish between the layouts.
I enabled auth and entered a number of mock users in db.auth_user, in
db.auth_group I entered three roles user_x, user_y and user_z, and in
db.auth_membership I gave the users membership of a group.
In the default controller I defined a function layout:
@auth.requires_login()
def layout():
if auth.has_membership(role='user_x'):
layout='user_x.html'
elif auth.has_membership(role='user_y'):
layout='user_y.html'
else:
layout='user_z.html'
return dict(layout=layout)
I created a default/layout.html view and had it extend layout:
{{extend layout}}
<h1>This is the default/layout.html template</h1>
{{=BEAUTIFY(response._vars)}}
I logged in several times as different users, and it SEEMS to work,
but only as long as you don't byte compile the application. I don't
know whether there is a solution for that problem.
Regards,
Annet.