Error in send_mail after upgrade to celery 4.4

Issue #363 resolved
vyom created an issue

After upgrading Kallithea to latest version has send_mail error.

Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,598: INFO/MainProcess] Received task: kallithea.lib.celerylib.send_email[25db2e2e-1a84-40bf-9561-cc7818f60ee4]
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,599: DEBUG/MainProcess] TaskPool: Apply <function _fast_trace_task at 0x7f42bc2ad048> (args:('kallithea.lib.celerylib.send_email', '25db2e2e-1a84-40bf-9561-cc7818f60
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,600: DEBUG/MainProcess] Task accepted: kallithea.lib.celerylib.send_email[25db2e2e-1a84-40bf-9561-cc7818f60ee4] pid:22129
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: [2020-02-26 07:06:08,728: ERROR/ForkPoolWorker-2] Task kallithea.lib.celerylib.send_email[25db2e2e-1a84-40bf-9561-cc7818f60ee4] raised unexpected: AttributeError("'dict' object has no at
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: Traceback (most recent call last):
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/celery/app/trace.py", line 385, in trace_task
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     R = retval = fun(*args, **kwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/celery/app/trace.py", line 650, in __protected_call__
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     return self.run(*args, **kwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/hg/kallithea/kallithea/lib/celerylib/__init__.py", line 67, in f_async
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     f_org(*args, **kwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "</home/kallithea/projects/kallithea/venv3/lib/python3.6/site-packages/decorator.py:decorator-gen-6>", line 2, in send_email
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/hg/kallithea/kallithea/lib/celerylib/__init__.py", line 127, in __wrapper
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     ret = func(*fargs, **fkwargs)
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:   File "/home/kallithea/projects/hg/kallithea/kallithea/lib/celerylib/tasks.py", line 284, in send_email
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]:     email.utils.quote('%s (no-reply)' % author.full_name_or_username),
Feb 26 07:06:08 kallithea-5-3 kallithea-cli[22116]: AttributeError: 'dict' object has no attribute 'full_name_or_username'

Comments (4)

  1. Mads Kiilerich

    Can you give more details of how to reproduce the problem? It could seem like the stack trace miss the important parts of how it ended up that way.

  2. vyom reporter

    The send_mail function fails when I use @username in comments to notify the user of change. Probably the code invoking the send_mail do not include the user’s full_name or username.

    When creating a pull request or adding reviewers the mail is send correctly.

  3. Log in to comment