I think you forgot auth.define_tables()
On Mar 23, 10:52 pm, Oscar <oscar.m...@gmail.com> wrote: > Hi all, > > I followed the example posted at the WiKi about auth, I extended Auth > class with: > > db.py -> > class MyAuth(Auth): > def __init__(self, environment, T, db = None): > Auth.__init__(self, environment, db) > self.messages.logged_in = T("Logged in") > self.messages.email_sent = T("Email sent") > self.messages.email_verified = T("Email verified") > self.messages.logged_out = T("Logged out") > self.messages.registration_successful = T("Registration > successful") > self.messages.invalid_email = T("Invalid email") > self.messages.invalid_login = T("Invalid login") > self.messages.verify_email_subject = T("Password verify") > self.messages.username_sent = T("Your username was emailed to > you") > self.messages.new_password_sent = T("A new password was > emailed to > you") > self.messages.password_changed = T("Password changed") > self.messages.retrieve_username = str(T("Your username > is"))+": % > (username)s" > self.messages.retrieve_username_subject = T("Username > retrieve") > self.messages.retrieve_password = str(T("Your password > is"))+": % > (password)s" > self.messages.retrieve_password_subject = T("Password > retrieve") > self.messages.profile_updated = T("Profile updated") > > auth = MyAuth(globals(), T, db) > > Then I enabled user at controllers: > > def user(): return dict(form=auth()) > > When I try to call user it returns the following: > > Error ticket for "welcome" > Ticket 127.0.0.1.2009-03-23.23-19-06.ea037521-4005-40f4-ac29- > ef8af121182a > > Error traceback > > Traceback (most recent call last): > File "/Users/Ra/codigo_fuente/web2py/gluon/restricted.py", line 98, > in restricted > exec ccode in environment > File "/Users/Ra/codigo_fuente/web2py/applications/welcome/ > controllers/default.py", line 14, in <module> > File "/Users/Ra/codigo_fuente/web2py/gluon/globals.py", line 75, in > <lambda> > self._caller = lambda f: f() > File "/Users/Ra/codigo_fuente/web2py/applications/welcome/ > controllers/default.py", line 8, in user > def user(): return auth() > File "/Users/Ra/codigo_fuente/web2py/gluon/tools.py", line 399, in > __call__ > return self.login() > File "/Users/Ra/codigo_fuente/web2py/gluon/tools.py", line 529, in > login > if 'username' in user.fields: > AttributeError: 'NoneType' object has no attribute 'fields' > > In file: /Users/Ra/codigo_fuente/web2py/applications/welcome/ > controllers/default.py > > def index(): > response.flash = T('Welcome to web2py') > return dict(message=T('Hello World')) > > # # uncomment the following if you have defined "auth" and "crud" in > models > #def user(): return dict(form=auth()) > def user(): return auth() > # def data(): return dict(form=crud()) > def download(): return response.download(request,db) > # # tip: use @auth.requires_login, requires_membership, > requires_permission > > response._vars=response._caller(user) > > I guess that the problem is at db = None when variables are > initialized. > > So... how I can fix it? > > Thanks in advance. > > BTW: My python skills are poor and sorry for my english. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---