On 1/26/22 00:16, IOhannes m zmoelnig wrote:
hi,
TL;DR is there a scriptable way to get all users that have registered in my mailman3 (3.2.1) instance and which lists they are subscribed to (if any)?
It's in Postorius >= 1.3.6
longer version:
we are running Mailman3-3.2.1 as shipped with Debian/buster (i know that this is not the newest version; at this point, please refrain from asking me to upgrade my Debian installation or even to switch to a venv installation of mailman3: i'll eventually do that but right now i've gt a problem to solve :-))
See above.
...
for this i would like to get a listing of all users that are not subscribed to any mailinglist. i would also like to query, when a given user has signed up (so i can reduce the number of false positives)
how would i do that? ideally i would rather not work on an SQL level.
You can do this in mailman shell
$ 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.
>>> um = getUtility(IUserManager)
>>> for usr in um.users:
... if len(list(usr.memberships.members)) > 0:
... continue
... adr = usr.addresses[0]
... print(f'Name: {adr.display_name}, Email: {adr.email}, Created:
{usr.created_on}')
...
Or to skip older ones
>>> from datetime import datetime
>>> um = getUtility(IUserManager)
>>> for usr in um.users:
... if len(list(usr.memberships.members)) > 0:
... continue
... if usr.created_on < datetime(2022, 1, 1):
... continue
... adr = usr.addresses[0]
... print(f'Name: {adr.display_name}, Email: {adr.email}, Created:
{usr.created_on}')
...
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan