#1093897 mailman3: i18n python traceback when delting a member

Package:
mailman3
Source:
mailman3
Submitter:
Peter Chubb
Date:
2025-01-24 02:24:01 UTC
Severity:
normal
Tags:
#1093897#5
Date:
2025-01-23 21:32:18 UTC
From:
To:
Dear Maintainer,

I tried to delete a member using the web interface from a list who has 'en' as
its locale.  The member *was* delted, but I saw an error messaye:
'pathlib._local.PosixPath' object does not support the context manager protocol


In the logs I see this backtrace:
2025-01-23 06:44:11 [FALCON] [ERROR] DELETE /3.1/lists/test.sel4.systems/member/
listadmin@sel4.systems => Traceback (most recent call last):
  File "falcon/app.py", line 365, in falcon.app.App.__call__
  File "/usr/lib/python3/dist-packages/mailman/rest/members.py", line 260, in on
_delete
    token, token_owner, member = manager.unregister(
                                 ~~~~~~~~~~~~~~~~~~^
        self._member.address,
        ^^^^^^^^^^^^^^^^^^^^^
        pre_approved=values.get('pre_approved'),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        pre_confirmed=pre_confirmed)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/app/subscriptions.py", line 593, in unregister
    list(workflow)
    ~~~~^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/app/workflow.py", line 69, in __next__
    return step()
  File "/usr/lib/python3/dist-packages/mailman/app/subscriptions.py", line 544, in _step_do_unsubscription
    delete_member(self.mlist, self.address.email)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/app/membership.py", line 142, in delete_member
    send_goodbye_message(mlist, email, language)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/app/notifications.py", line 119, in send_goodbye_message
    goodbye_message = wrap(expand(getUtility(ITemplateLoader).get(
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        'list:user:notice:goodbye', mlist, language=language.code),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/model/template.py", line 211, in get
    path, fp = find(default_uri, mlist, code)
               ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/utilities/i18n.py", line 157, in find
    for search_path in raw_search_order:
                       ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mailman/utilities/i18n.py", line 117, in search
    templates_dir = str(resources.enter_context(
                        ~~~~~~~~~~~~~~~~~~~~~~~^
        files('mailman').joinpath('templates')))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/contextlib.py", line 528, in enter_context
    raise TypeError(f"'{cls.__module__}.{cls.__qualname__}' object does "
                    f"not support the context manager protocol") from None
TypeError: 'pathlib._local.PosixPath' object does not support the context manager protocol

#1093897#10
Date:
2025-01-24 02:14:27 UTC
From:
To:
See https://gitlab.com/mailman/mailman/-/merge_requests/1309