This is already in trunk @auth.requires_login()
Massimo On May 17, 1:56 pm, Jose <jjac...@gmail.com> wrote: > Hello > > I have followed the threads: > [1] [2] [3] > > I have four controllers, one of them is identidad.py, who defines the > decorator: > > def requiere_login(fn): > def inner(*a,**b): > if session.authorized: > return fn(*a,**b) > else: > redirect(URL(r=request, f='login')) > return inner > > I need to decorate functions of other controllers. > > I tried to import without success of several ways. > > 1) > import identidad > > 2) > import applications.my_app.controllers.identidad as identidad > > 3) > from gluon.shell import exec_environment > > identidad=exec_environment('applications/my_app/controllers/ > identidad.py') > identidad.session = session > > @identidad.requiere_login > def my_function(): > ... > ... > > Regards > Jose > > [1]http://groups.google.com/group/web2py/browse_thread/thread/31b511d279... > > [2]http://groups.google.com/group/web2py/browse_thread/thread/81aa1c1fc3... > > [3]http://groups.google.com/group/web2py/browse_thread/thread/1423caafc4... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---