On Thu, Aug 6, 2020, at 6:12 PM, Mark Sapiro wrote:
Mark Sapiro wrote:
On 7/28/20 5:40 AM, Brian Carpenter wrote:
This is the client that I asking about in my post. She said what I did, did not work. This is what I did:
Get into a venv as user mailman
#mailman shell from mailman.model.mailinglist import MailingList mlist = MailingList('listname@listdomain.org') mlist.emergency = False commit() ctrl-d (just to be on the safe side)
I half understand why this didn't work. Instantiating the list via
from mailman.model.mailinglist import MailingList mlist = MailingList('listname@listdomain.org')
for some reason (that's the half I don't understand) does not get the actual list object so changes you make to it don't affect the actual list.
It is because when you simply instantiate that class, it will create
a new model instance, that you would need to persist by adding
to database using store.add(mlist)
.
If you instead want to read that instance from database, you have
to do store.query()
, which is what the .get()
method of IListManager
does.
In
mailman shell
you need to domlist = getUtility(IListManager).get('listname@listdomain.org')
getUtility
andIListManager
are in the namespace inmailman shell
, but outside of that, e.g. just inpython
in your virtualenv, you also needfrom mailman.interfaces.listmanager import IListManager from zope.component import getUtility
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)