Lost in default style creation
Hi all
I have installed a brandnew server - ubuntu 21.10, mailman3 version 3.3.3 (Tom Sawyer)
I want to set some default settings to all new lists, as we are creating them through API from another system, i do this (snipped straight from the shell) :
from mailman.interfaces.styles import IStyleManager manager = getUtility(IStyleManager) from zope.interface import implementer from mailman.interfaces.styles import IStyle @implementer(IStyle) ... class EcoStyle: ... name = 'ECOstyle' ... description = 'ECO mailing list style.' ... def apply(self, ml): ... ml.dmarc_mitigate_action = 'munge_from' ... ml.dmarc_mitigate_unconditionally = 'True' ... ml.send_welcome_message = 'True' ... ml.subject_prefix = '' ... ml.subscription_policy = 'moderate' ... ml.max_message_size = '0' ... manager.register(EcoStyle()) commit()
from zope.component import getUtility from mailman.interfaces.styles import IStyleManager manager = getUtility(IStyleManager)
for style in manager.styles: ... print(style.name) ... ECOstyle legacy-announce legacy-default
No error all seem good, i then do this to confirm the style is there: private-default
It shows me its there, then i proceed to quit() and go back in to the shell, and do this:
quit() ecoadmin@list01:/etc/mailman3$ sudo mailman shell Welcome to the GNU Mailman shell
from zope.component import getUtility from mailman.interfaces.styles import IStyleManager manager = getUtility(IStyleManager)
for style in manager.styles: ... print(style.name) ... legacy-announce legacy-default private-default
and now my newly created style is gone again ?
What am i missing here ?
Kind regards Kenneth Karlsson
Ok, that looked weird, i try again with no python marks.
from mailman.interfaces.styles import IStyleManager manager = getUtility(IStyleManager) from zope.interface import implementer from mailman.interfaces.styles import IStyle @implementer(IStyle) class EcoStyle: name = 'ECOstyle' description = 'ECO mailing list style.' def apply(self, ml): ml.dmarc_mitigate_action = 'munge_from' ml.dmarc_mitigate_unconditionally = 'True' ml.send_welcome_message = 'True' ml.subject_prefix = '' ml.subscription_policy = 'moderate' ml.max_message_size = '0'
manager.register(EcoStyle()) commit()
from zope.component import getUtility from mailman.interfaces.styles import IStyleManager manager = getUtility(IStyleManager)
for style in manager.styles: print(style.name)
ECOstyle legacy-announce legacy-default private-default
quit() ecoadmin@list01:/etc/mailman3$ sudo mailman shell Welcome to the GNU Mailman shell
from zope.component import getUtility from mailman.interfaces.styles import IStyleManager manager = getUtility(IStyleManager)
for style in manager.styles: print(style.name)
legacy-announce legacy-default private-default
On 6/2/22 02:44, kenneth.karlsson@eco.cept.org wrote:
It shows me its there, then i proceed to quit() and go back in to the shell, and do this:
quit() ecoadmin@list01:/etc/mailman3$ sudo mailman shell Welcome to the GNU Mailman shell
from zope.component import getUtility
...
More recent versions of mailman shell will tell you what the problem is.
$ ./mailman shell
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
>>>
You need to exit the shell with control-D or issue a commit() before you exit.
Also, NEVER run any mailman
commands as root. Always run mailman
as
the Mailman user. Running mailman
as root can create files owned by
root that can't be read/modified by the Mailman user. More recent
versions will tell you
$ sudo ./mailman
Usage: mailman [OPTIONS] COMMAND [ARGS]...
Try 'mailman -h' for help.
Error: If you are sure you want to run as root, specify --run-as-root.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
kenneth.karlsson@eco.cept.org
-
Mark Sapiro