In fact, just to make sure there wasn't something hidden in my app affecting
the behavior,
I downloaded a fresh install of web2py,
and get the same error:
File "/home/pierluigi/web2py/gluon/tools.py", line 1796, in register
user = self.db(table_user[username] == form.vars[username]).select().first()
KeyError: 'email'
Adding just this code to the 'welcome' app:
def user():
if request.args(0)=='register':
auth.settings.table_user.email.default = '[email protected]'
auth.settings.table_user.email.writable=False
auth.settings.registration_requires_verification = False
return dict(form=auth())
L.
On Wed, Jul 6, 2011 at 8:35 PM, Luis Goncalves <[email protected]> wrote:
> Yes, when I click on the invite and go to the website I get the
> registration form filled out with email (and name (excluded from my
> shortened example)) visible and non-editable.
>
> Luis.
>
> —«sent by mobile»—
> On Jul 6, 2011 8:17 PM, "Massimo Di Pierro" <[email protected]>
> wrote:
> > Are you sure your db.registrant has an email?
> >
> > On Jul 6, 10:04 pm, Luis Goncalves <[email protected]> wrote:
> >> I still get the same error:
> >>
> >> File "/home/ubuntu/web2py/gluon/tools.py", line 1683, in register
> >> user = self.db(table_user[username] ==
> form.vars[username]).select().first()
> >> KeyError: 'email'
> >>
> >> I don't know if it makes a difference or not, but I'm using emails for
> login
> >> (not a username) -- as is probably clear to you from the above error.
> >>
> >> Code is now:
> >>
> >> def user():
> >>
> >> if request.args(0)=='register':
> >>
> >> registrant = db( db.registrant.token == request.vars.token
> >> ).select().first()
> >>
> >> auth.settings.table_user.email.default = registrant.email
> >> auth.settings.table_user.email.writable=False
> >>
> >> auth.settings.registration_requires_verification = False
> >>
> >> return dict(form=auth())
>