Error when accessing users groups

Issue #303 resolved
Soren Mathiasen created an issue


When trying to access the users groups menu as the admin user, we get the following error.

Error - <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'username' URL: File '/usr/local/lib/python2.7/dist-packages/weberror/', line 162 in call app_iter = self.application(environ, sr_checker) File '/usr/local/lib/python2.7/dist-packages/RhodeCode-1.2.3-py2.7.egg/rhodecode/lib/middleware/', line 106 in call return self.application(environ, start_response) File '/usr/local/lib/python2.7/dist-packages/RhodeCode-1.2.3-py2.7.egg/rhodecode/lib/middleware/', line 71 in call return self.application(environ, start_response) File '/usr/local/lib/python2.7/dist-packages/beaker/', line 152 in call return self.wrap_app(environ, session_start_response) File '/usr/local/lib/python2.7/dist-packages/routes/', line 131 in call response =, start_response) File '/usr/local/lib/python2.7/dist-packages/pylons/', line 107 in call response = self.dispatch(controller, environ, start_response) File '/usr/local/lib/python2.7/dist-packages/pylons/', line 312 in dispatch return controller(environ, start_response) File '/usr/local/lib/python2.7/dist-packages/RhodeCode-1.2.3-py2.7.egg/rhodecode/lib/', line 52 in call return, environ, start_response) File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/', line 211 in call response = self._dispatch_call() File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/', line 162 in _dispatch_call response = self._inspect_call(func) File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/', line 105 in _inspect_call result = self._perform_call(func, args) File '/usr/local/lib/python2.7/dist-packages/pylons/controllers/', line 57 in _perform_call return func(args) File '/usr/local/lib/python2.7/dist-packages/RhodeCode-1.2.3-py2.7.egg/rhodecode/controllers/admin/', line 64 in index return render('admin/users_groups/users_groups.html') File '/usr/local/lib/python2.7/dist-packages/pylons/', line 243 in render_mako cache_type=cache_type, cache_expire=cache_expire) File '/usr/local/lib/python2.7/dist-packages/pylons/', line 218 in cached_template return render_func() File '/usr/local/lib/python2.7/dist-packages/pylons/', line 240 in render_template return literal(template.render_unicode(globs)) File '/usr/local/lib/python2.7/dist-packages/mako/', line 311 in render_unicode as_unicode=True) File '/usr/local/lib/python2.7/dist-packages/mako/', line 660 in _render kwargs_for_callable(callable, data)) File '/usr/local/lib/python2.7/dist-packages/mako/', line 692 in render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File '/usr/local/lib/python2.7/dist-packages/mako/', line 713 in _exec_template _render_error(template, context, e) File '/usr/local/lib/python2.7/dist-packages/mako/', line 722 in _render_error result = template.error_handler(context, error) File '/usr/local/lib/python2.7/dist-packages/mako/', line 711 in _exec_template callable(context, *args, kwargs) File '/home/schantz/rhodecode/data/templates/base/', line 62 in render_body M_writer(escape(next.body())) File '/home/schantz/rhodecode/data/templates/base/', line 160 in render_body M_writer(escape(next.main())) File '/home/schantz/rhodecode/data/templates/admin/users_groups/', line 88 in render_main __M_writer(escape(', '.join([x.user.username for x in u_group.members[:50]]))) AttributeError: 'NoneType' object has no attribute 'username'

Comments (5)

  1. Marcin Kuzminski repo owner

    Did you upgrade from some previous version ? And I'm assuming you're using sqlite ?

  2. Soren Mathiasen reporter

    The error existed in 1.2.2 and still in 1.2.3.

    But yes we made an upgrade, and are using sqlite.

  3. Marcin Kuzminski repo owner

    This is a problem of FK not doing a cascade delete when removing user. That's why i asked from what version you are using it. You deleted an user that was in some group, and now he's still referenced in userToGroup assignment.

    To fix this delete entries from table users_groups_members which references users that are not present in users table

  4. Soren Mathiasen reporter

    Fixed using the following sql delete from users_groups_members where users_group_member_id not in ( select users_group_member_id from users_groups_members join users on users.user_id = users_groups_members.user_id )

  5. Log in to comment