Hello,
investigating authentication with OpenId in web2py I encountered some
issues. For testing purposes I used the wizard to create a new
application "tmp1" with all default settings (notably sqlite db).
According to the book I added the 2 lines to db.py to import and
activate OpenId. In the default controller I added a new method
"secure" and decorated it with @auth.requires_login(), and in the
index-template i added a link that leads to 'secure'.

When I click that link I properly get the login form asking for an
OpenId Url, I can login with that, web2py tells, verification is ok.
Then I get asked to login as web2py user or register.

Here the issues start:
(1) I am not registered yet, so I choose that. After registering, I am
logged in, but no association to my OpenId is stored.

(2) When I want to login a second time, web2py tells me again, that it
has no association with my OpenId and again asks for local login or
registration. Since now I have an account, I enter my username and
password, and then this error occurs:
Traceback (most recent call last):

  File "/web2py/gluon/restricted.py", line 188, in restricted
    exec ccode in environment
  File "/web2py/applications/tmp1/controllers/default.py", line 19, in
<module>
  File "/web2py/gluon/globals.py", line 95, in <lambda>
    self._caller = lambda f: f()
  File "/web2py/applications/tmp1/controllers/default.py", line 3, in
user
    def user(): return dict(form=auth())
  File "/web2py/gluon/tools.py", line 1034, in __call__
    return self.login()
  File "/web2py/gluon/tools.py", line 1503, in login
    cas_user = cas.get_user()
  File "/web2py/gluon/contrib/login_methods/openid_auth.py", line 200,
in get_user
    self._associate_user_openid(self.auth.user, oid)
  File "/web2py/gluon/contrib/login_methods/openid_auth.py", line 244,
in _associate_user_openid
    self.db.alt_logins.insert(username=oid, user=user)
  File "/web2py/gluon/dal.py", line 3952, in insert
    return self._db._adapter.insert(self,self._listify(fields))
  File "/web2py/gluon/dal.py", line 711, in insert
    query = self._insert(table,fields)
  File "/web2py/gluon/dal.py", line 707, in _insert
    values = ','.join(self.expand(v,f.type) for f,v in fields)
  File "/web2py/gluon/dal.py", line 707, in <genexpr>
    values = ','.join(self.expand(v,f.type) for f,v in fields)
  File "/web2py/gluon/dal.py", line 821, in expand
    return self.represent(expression,field_type)
  File "/web2py/gluon/dal.py", line 1131, in represent
    return str(int(obj))
TypeError: 'NoneType' object is not callable

Can someone please shed some light on this and/or point me in the
right direction. Thanks.

KR, drebbin

Reply via email to