Skip to content

Registrar user may be null, resulting in an exception when attempting to display their email #3232

@sentry-io

Description

@sentry-io

This occurs after the successful submission of a registrar approval, but then fails on the success message to the user. If it's OK for the registrar user to be null then the message should handle that case.

Sentry Issue: PERMA-2HA

AttributeError: 'NoneType' object has no attribute 'email'
(1 additional frame(s) were not displayed)
...
  File "django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "perma/utils.py", line 96, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "perma/views/user_management.py", line 364, in approve_pending_registrar
    messages.add_message(request, messages.SUCCESS, f'Registrar request for <strong>{target_registrar}</strong> denied. Please inform {target_registrar_user.email} if appropriate.', extra_tags='safe')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions