Hi Steve,
I tried to use your approach today:
On Fri, Jun 2, 2023 at 8:30 AM Stephen J. Turnbull < turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
...
What you can do is create a style in Python and make that the
default. In $SITE_PKGS/mailman/styles/default.py, append:
-------------------------------- cut here -------------------------------- from mailman.interfaces.archiver import ArchivePolicy
@public @implementer(IStyle) class ArchivesDefaultDisabledStyle(LegacyDefaultStyle):
"""The legacy default style with archiving disabled.""" name = 'archives-disabled' description = _('Ordinary discussion mailing list style,' ' with archiving disabled') def apply(self, mailing_list): super().apply(self, mailing_list) mlist.archive_policy = ArchivePolicy.never
-------------------------------- cut here --------------------------------
In mailman.cfg find and modify or create:
-------------------------------- cut here -------------------------------- [styles] default: archives-disabled -------------------------------- cut here --------------------------------
I used it with a different source list - it's PrivateDefaultStyle.
When I try to create a new list using the new custom style I get an error:
2024-04-21 12:16:08 [FALCON] [ERROR] POST /3.1/lists => Traceback (most recent call last): File "falcon/app.py", line 365, in falcon.app.App.__call__ File "/usr/lib/python3.11/site-packages/mailman/rest/lists.py", line 321, in on_post mlist = create_list(**validator(request)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mailman/app/lifecycle.py", line 100, in create_list style.apply(mlist) File "/usr/lib/python3.11/site-packages/mailman/styles/default.py", line 107, in apply super().apply(self, mailing_list) TypeError: PrivateDefaultStyle.apply() takes 2 positional arguments but 3 were given
Untested, feel free to ask if it doesn't seem to work.
Could you check what's the issue, please?
Danil Smirnov
This really should be implemented as a plug-in so default.py being
overwritten in an upgrade won't be a problem, but the plug-in API is annoyingly complicated and the example plug-in over-engineered, and I couldn't get it to work (and in the project where I learned to do this I am not being paid enough to care ;-). The approach above was straightforward.
Eventually I'll get around to doing the plug-in approach, and maybe in the meantime Mark or Abhilash will speak up. If Those Who Know don't show up soon, ask again in the medium term (but before you update Mailman and it gets overwritten :-).
Steve
Sincerely, Danil Smirnov