On 1/26/22 17:19, Mark Sapiro wrote:
On 1/26/22 00:16, IOhannes m zmoelnig wrote:
You can do this in mailman shell[...]> ```
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}') ...
perfect. that did the trick, thanks a lot.
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
i'm not entirely sure how this relates to the above (working) snippet.
is it, that with postorious>=1.3.6 i would be able to perform that task from the webinterface, rather than having to resort to 'mailman shell'?
in any case, this might be related:
before i received your email with the 'mailman shell' snippet, i scraped
some bits of my django knowledge and visited
<https://lists.example.com/admin> (the django admin interface), and
noticed the list of users there.
so i scraped that page for users (assuming that this was the list of
registered users).
then i get myself a list of all subscribers in my instance, using a
crude mailman lists | grep "@" | while read l; do mailman members "${l}"; done | sort -u
.
finally i calculated the difference between the two sets.
interestingly the results are quite different from the ones i got from your script: both sets contain users that are not in the other set. how come?
gfmdras IOhannes