Wessel Kraaij writes:
I changed several defaults in mailman core (e.g. preferred language).
Do you mean "default_language"? There is no default "preferred language"; that's a list-specific setting.
And what do you mean by "changed in mailman core"? Settings in mailman.cfg? Source patches?
However, Postorius (maxking version) initializes the defaults for new lists and overrides the core defaults using a PATCH call on the REST API.
I don't understand why that would happen. The core defaults are the source of the initial values in the create list form. Specifically, when Postorius creates a list, it initializes a proxy object in mailmanclient, which talks REST API to Mailman core, which creates an actual MailingList object. This uses the defaults from the system_defaults object or default style if one is defined. This is reflected in Postorius's proxy MailingList, which is used to initialize values in the form presented to the administrator. Then they can change various aspects of the list's identity including preferred language from that form.
So if you have set default_language in the [mailman] section of mailman.cfg, you should get the desired initial preferred language for your lists.
As far as I know, this hasn't been reported before. It's not happening to most installations (and many of them do specify default_language). It's true that docker-mailman is not the most common configuration, but it does use stock mailman and postorius from PyPI. So I really don't understand why you have a problem if you are creating mailman.cfg correctly.
With the aid of some gentle AI chatbot,
Heaven preserve us from *all* AI chatbots, gentle or violent. All are sources of bad advice and annoyance to volunteer software maintainers.
You absolutely should not need to patch any code to do what you want to do with preferred_language.
Here is the code snippet [added to list_new in postorius/views/list.py] that solved my issue
This is a bad idea. You will have to remember to patch Postorius
again if you ever update it. Also, if for some reason you ever create
lists using the mailman create utility, mailman shell, or a REST
API client, these settings will not be applied to those lists.
I added the following 'defaults' in my settings file: DEFAULT_LIST_SETTINGS = { 'preferred_language': 'nl', 'subscription_policy': 'confirm', 'default_member_action': 'defer', 'default_nonmember_action': 'hold', 'reply_goes_to_list': 'point_to_list', 'reply_to_address': '', 'max_message_size': 10240, 'anonymous_list': False, 'dmarc_mitigate_action': 'munge_from', 'collapse_alternatives': False, 'dmarc_mitigate_unconditionally': True, }
Most of the settings above cannot currently be changed in mailman.cfg. However, you can create a plugin to do this without patching any sources. The example plugin <https://gitlab.com/mailman/example-mailman-plugin> shows how to create a trivial style (as well as several components you don't need). See documentation in https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/plugins/doc.... For examples of styles, see mailman/styles/default.py. To change the default style, edit (or add) the "default" setting in the "[styles]" section of mailman.cfg.
Regards, Steve
-- GNU Mailman consultant (installation, migration, customization) Sirius Open Source https://www.siriusopensource.com/ Software systems consulting in Europe, North America, and Japan