Denes,
I also went down this path and this is what I got. When the Auth class
references self.user.id it appears to be expecting that the user
table will have a field called 'id'. From glancing at the code it
appears that self.user.id is expected to be a key in a Storage , so in
effect the name of the id field is hard coded.
Traceback (most recent call last):
File "gluon/restricted.py", line 173, in restricted
exec ccode in environment
File "/var/www/web2py/web2py.1.76.5/applications/MyApp/controllers/
default.py", line 434, in <module>
File "gluon/globals.py", line 96, in <lambda>
self._caller = lambda f: f()
File "/var/www/web2py/web2py.1.76.5/applications/MyApp/controllers/
default.py", line 81, in user
return dict(form=auth())
File "gluon/tools.py", line 723, in __call__
return self.login()
File "gluon/tools.py", line 1130, in login
self.log_event(log % self.user)
KeyError: 'id'
Below is a patch for gluons/tools.py, that uses auth.settings.id_field
to determine the id field. It fixes the errors that I was having, but
I haven't tested it extensively and I'm not sure if I'm missing
something obvious in my configuration that would remove the need for
this change.
Chris Guest
580a581
> self.settings.id_field = 'id'
955a957,959
> if self.settings.id_field!='id':
> user.id = user[self.settings.id_field]
>
1108a1113,1114
> if self.settings.id_field!='id':
> user.id = user[self.settings.id_field]
1263a1270,1271
> if self.settings.id_field!='id':
> user.id = user[self.settings.id_field]
--
To unsubscribe, reply using "remove me" as the subject.