oops while logging about ratelimit

Bug #987990 reported by Ricardo Kirkner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical SSO provider
Confirmed
High
Unassigned

Bug Description

A user reported an OOPS on SSO (2306carambolaubuntu1403) on 2012-04-24.

By inspecting the oops report is shows

Traceback (most recent call last):
  Module /srv/login.ubuntu.com/production/canonical-identity-provider/identityprovider/decorators.py, line 205, in disallowed
    request.user.username, remote_ip, request.user.id)
  Module /srv/login.ubuntu.com/production/canonical-identity-provider/identityprovider/decorators.py, line 148, in view_wrapper
    return self.disallowed(request)
  Module /srv/login.ubuntu.com/production/canonical-identity-provider/identityprovider/decorators.py, line 134, in wrapper
    return self.view_wrapper(request, fn, *args, **kwargs)
  Module /usr/lib/pymodules/python2.6/django/utils/decorators.py, line 28, in _wrapper
    return bound_func(*args, **kwargs)
  Module /usr/lib/pymodules/python2.6/django/utils/decorators.py, line 24, in bound_func
    return func(self, *args2, **kwargs2)
  Module /srv/login.ubuntu.com/production/canonical-identity-provider/identityprovider/decorators.py, line 42, in _dont_cache_decorator
    response = func(request, *args, **kwargs)
  Module /usr/lib/pymodules/python2.6/django/utils/decorators.py, line 28, in _wrapper
    return bound_func(*args, **kwargs)
  Module /usr/lib/pymodules/python2.6/django/views/generic/base.py, line 47, in view
    return self.dispatch(request, *args, **kwargs)
  Module /usr/lib/pymodules/python2.6/django/core/handlers/base.py, line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  Module /usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py, line 273, in __call__
    response = self.get_response(request)
AttributeError: ' 'Account' object has no attribute 'username''

which indicates an error in the code handling the logging of a ratelimit-blocked post

def disallowed(self, request):
    remote_ip = self.remote_ip(request)
    logger = logging.getLogger('ratelimit.disallowed')
    logger.warn("%s (%s) exceeded rate limit for %s"
                             request.user.username, remote_ip, request.user.id)
    return HttpResponseForbidden(render_to_string('limitexceeded.html'))

request.user is an instance of Account due to the

identityprovider.middleware.useraccount.UserAccountConversionMiddleware

middleware.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.