Issues with sending mail in indico 3.3.1 and 3.3.2

Hi,
when the users try to send an email to participants they get an error like:

2024-06-08 13:23:45,577  3b20540b48ff495b  296     indico.flask - ERROR errors.py:110 -- 'NoneType' object has no attribute 'is_ticket'

Traceback (most recent call last):
  File "/opt/indico/.venv/lib/python3.12/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/web/flask/util.py", line 80, in wrapper
    return obj().process()
           ^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/web/rh.py", line 299, in process
    res = self._do_process()
          ^^^^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/web/rh.py", line 267, in _do_process
    rv = self._process()
         ^^^^^^^^^^^^^^^
  File "/opt/indico/.venv/lib/python3.12/site-packages/indico/modules/events/registration/controllers/management/reglists.py", line 332, in _process
    template_is_ticket = self.regform.get_ticket_template().is_ticket
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'is_ticket'

I have tried to create a default ticket template, but to no avail. Trying to administrate the tickets on the participants page also fails with a NoneType object error.

Surrounding the code snippets in line 332 and 303 in reglists.py with try: / except AttributeError:
makes the email sending work.

Is this a bug?

I’m surprised you have no default ticket template in your database. Such a template should always exist…

Anyway, check this post for the fix: Unexpected Exception occurred at <my_indico_host>: 'NoneType' object has no attribute 'is_ticket' - #4 by ThiefMaster

This is a very old instance that has been through multiple upgrades. All the way back from the ZODB days. So perhaps it was never correctly introduced, and the indico db upgrade, never got it in there?

Anyway, it works now with the default ticket, and without my hacks. Thanks!

Hm, that may be the case. I just checked and I only find the code where we create it on new instances, but nothing where we add it to an existing instance during the usual DB upgrades…