16 Oct
2022
16 Oct
'22
3:03 a.m.
On 10/15/22 02:47, Martin Lorenz wrote:
Mark Sapiro wrote:
On 10/11/22 07:04, bob B via Mailman-users wrote: [...] run mailman' mean you are an admin of the server on which it is installed? If so, you can do this in mailman shell, but what do you
in my case: yes
want to see? I.e., just a summary by list of subject, sender and hold reason
how would I do this?
For example, a mailman shell
interaction like this
$ /opt/mailman/mm/bin/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.
>>> for mlist in getUtility(IListManager):
... requests = IListRequests(mlist)
... first = True
... for request in requests.held_requests:
... key, data = requests.get_request(request.id)
... if first:
... first = False
... print(mlist.list_id)
... print(f"""\
... Sender: {data['_mod_sender']}
... Subject: {data['_mod_subject']}
... Date: {data['_mod_hold_date']}
... Reason: {data['_mod_reason']}
... """)
...
Additional question: how would I set/change the owner of a number of lists identifyable by a regular expression?
Something like this:
>>> import re
>>> newowner = 'newowner@example.com'
>>> user_manager = getUtility(IUserManager)
>>> # get the address record for the new owner
>>> address = user_manager.get_address(newowner)
>>> # create one if necessary
>>> if address is None:
... user = user_manager.create_user(newowner)
... address = list(user.addresses)[0]
...
>>> for mlist in getUtility(IListManager):
... if not re.search('the criterion', mlist.list_id):
... continue
... # remove existing owners
--- for owner in mlist.owners.members:
... owner.unsubscribe()
... # add new owner
... mlist.subscribe(address, MemberRole.owner)
...
>>> commit()
>>>
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan