On Wednesday, July 24, 2013 7:56:48 AM UTC-4, Marin Pranjić wrote: > put the logic on top of controller file: > > if not auth.is_logged_in(): > redirect( ... ) >
Or if you want to get the automatic redirect and messaging behavior of the @auth.requires_login() decorator, you can use this trick: # At the top of the controller auth.requires_login()(lambda: None)() auth.requires_login() returns a decorator that takes a function and returns another function -- above just passes a dummy lambda function to the decorator and then calls the resulting function to run the requires_login code. Works with the other Auth decorators as well (all of which ultimately call auth.requires(), which is the method that produces the decorator). Anthony > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.