Page MenuHomePhabricator

Prevent coordinator email server error on some applications
Open, Needs TriagePublic

Description

A server error was prompted on https://wikipedialibrary.wmflabs.org/applications/evaluate/9026/ on the step where the coordinator is emailed:

Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/venv/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/venv/lib/python3.8/site-packages/django_comments/views/comments.py", line 123, in post_comment
    signals.comment_was_posted.send(
  File "/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 173, in send
    return [
  File "/venv/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 174, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/app/TWLight/emails/tasks.py", line 252, in send_comment_notification_emails
    recent_app_coordinator.email,

Exception Type: AttributeError at /comments/post/
Exception Value: 'NoneType' object has no attribute 'email'

The partner is currently marked unavailable, and the coordinator is no longer assigned. It looks like we might not be handling the case where there's simply no recent coordinator to email properly.