louking / rrwebapp

Race Results Web Application
0 stars 1 forks source link

set role of new club: AttributeError: 'NoneType' object has no attribute 'id' #509

Closed louking closed 3 years ago

louking commented 3 years ago

After

Note: still occurs when log user out / in

Related: #498

Message type:       ERROR
Location:           /var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/app.py:1892
Module:             app
Function:           log_exception
Time:               2021-07-22 06:43:15,129
User:               lking@pobox.com

Message:

Exception on /admin/_setpermission [GET]

Traceback (most recent call last):
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/var/www/sandbox.scoretility.com/venv/lib64/python3.6/site-packages/flask_principal.py", line 199, in _decorated
    rv = f(*args, **kw)
  File "/var/www/sandbox.scoretility.com/rrwebapp/rrwebapp/views/admin/userrole.py", line 353, in _set_permission
    success = _setpermission(thisclub,thisuser,rolename,setrole)
  File "/var/www/sandbox.scoretility.com/rrwebapp/rrwebapp/views/admin/userrole.py", line 315, in _setpermission
    if thisrole.id not in [r.id for r in user.roles]:
AttributeError: 'NoneType' object has no attribute 'id'