It is a bug. For now do

auth.settings.lock_keys = False

then do

auth.settings.on_failed_authorization=URL(r=request,f='error')


On Feb 7, 9:21 pm, Tito Garrido <[email protected]> wrote:
> Hi,
>
> I'm tring to test web2 1.56 but when I try to use on_failed_authotization
> atribute I get:
>
> AttributeError: 'Auth' object has no attribute 'on_failed_authorization'
>
> MODEL:
> from gluon.tools import Mail, Auth, Crud     # new in web2py 1.56
> mail=Mail()                                  # mailer
> mail.settings.server='smtp.gmail.com:587'    # your SMTP server
> mail.settings.sender='[email protected]'         # your email
> mail.settings.login='username:password'      # your credentials
> auth=Auth(globals(),db)                      # authentication/authorization
> #auth.settings.mailer=mail                     # for user email verification
> auth.define_tables()                         # creates all needed tables
> crud=Crud(globals(),db)                      # for CRUD helpers using auth
> crud.settings.auth=auth          # (optional) enforces authorization on crud
>
> CONTROLLER:
> auth.settings.on_failed_authorization=URL(r=request,f='error')
> def user(): return dict(form=auth())
> def data(): return dict(form=crud())
> def download(): return response.download(request,db)
> def error(): return dict(message = T("not authorized"))
>
> A dir on auth.settings returns:
> *auth
> *:__class__
> __cmp__
> __contains__
> __delattr__
> __delitem__
> __dict__
> __doc__
> __eq__
> __ge__
> __getattr__
> __getattribute__
> __getitem__
> __getstate__
> __gt__
> __hash__
> __init__
> __iter__
> __le__
> __len__
> __lt__
> __module__
> __ne__
> __new__
> __reduce__
> __reduce_ex__
> __repr__
> __setattr__
> __setitem__
> __setstate__
> __str__
> __weakref__
> clear
> copy
> fromkeys
> get
> has_key
> items
> iteritems
> iterkeys
> itervalues
> keys
> pop
> popitem
> setdefault
> update
> values
>
> Thanks in advance,
>
> Tito
>
> --
> Linux User #387870
> .........____
> .... _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:_______
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to