I've hacked something based on request.env.query_string because it's not working with the session if the first page visited is a protected one.
Unfortunately, I think I might have found a bug. Here's an excerpt of the user.html file I use: {{if "/appname/contname" in request.env.query_string:}} {{extend 'contname-layout.html'}} {{else:}} {{extend 'layout.html'}} {{pass}} <h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2> ------8<------ When using this version of user.html I have the following error (copied from the ticket): 1. Traceback (most recent call last): 2. File "/home/julie/prog/zwip/web2py/gluon/restricted.py", line 193, in restricted 3. ccode = compile2(code,layer) 4. File "/home/julie/prog/zwip/web2py/gluon/restricted.py", line 179, in compile2 5. return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec') 6. File "/home/julie/prog/zwip/web2py/applications/zwip/views/ default/user.html", line 67 7. elif left_sidebar_enabled != right_sidebar_enabled: width_content='740px' 8. ^ 9. SyntaxError: invalid syntax 10. And at the end of the ticket: ------8<------ 60. response.write('\n\n ', escape=False) 61. #using sidebars need to know what sidebar you want to use 62. #prior of using it, because of static width size of content, you can use 63. #left_sidebar, right_sidebar, both or none (False left and right) 64. left_sidebar_enabled = globals().get('left_sidebar_enabled',False) 65. right_sidebar_enabled = globals().get('right_sidebar_enabled',False) 66. if left_sidebar_enabled and right_sidebar_enabled: width_content='63%' 67. elif left_sidebar_enabled != right_sidebar_enabled: width_content='740px' 68. else: width_content='100%' 69. if left_sidebar_enabled: left_sidebar_style = 'style="display: block;"' ------>8------ It looks like the "else" introduced in the "user.html" is breaking the identation of the code found in the default "layout.html" after the inclusion of "web2py_ajax.html". Right now, as a workaround, I'm using another layout but I might have to also add code on my layouts later on and that could become problematic. If there's a better way of doing I'm all ears. On Oct 2, 6:44 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > As a quick solution, store the last visited page in session and check > check in user > > is not request.function == 'user': > session.last_action = request.function > > controller A > @auth.requires_login() --> send to a view user.html specific for > controller A > def myfunctionA(): > return dict() > controller B > @auth.requires.login() --> send to the default view user.html > def myfunctionB(): > return dict() > > def user(): > # use session.last_action > return dict(form=auth()) > > On Oct 2, 2:42 am, Julie Bouillon <julie.bouil...@yedia.com> wrote: > > > > > > > > > On 10/02/2011 06:53 AM, Massimo Di Pierro wrote:> How do you know if a user > > that has not yet logged is special or not? > > > Can you provide an example? > > > > On Oct 1, 1:22 pm, "julie.bouil...@yedia.com" > > > <julie.bouil...@yedia.com> wrote: > > >> Hi, > > > >> Is it possible to define different auth page for the same application ? I > > >> mean having an auth page for "regular" user and another one for "special" > > >> user. > > > >> I tried by adding a user function in a specific controller and added a > > >> user.html for that controller but whenever an authentication is required > > >> I'm > > >> sent to the default user.html. > > > I presume the kind of user depending on which view they try to access. > > > Example: > > > controller A > > @auth.requires_login() --> send to a view user.html specific for > > controller A > > def myfunctionA(): > > return dict() > > > controller B > > @auth.requires.login() --> send to the default view user.html > > def myfunctionB(): > > return dict() > > > I know there is the _next value passed to the user.html view, but > > intuitively it feels like a not that good idea to use that... Anything > > more elegant than that ?