https://dpaste.com/39ZMH3M7S (Text below)
The code works perfectly when pasted into the live shell of mailman.
But not when I start "(venv) mailman withlist -r set_member_pref".
...
module = import_module(module_path)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'set_members_prefs'
What is wrong?
Please can anyone help?
Please can you add information in the documentation how exactly to run a script
like that?
# def set_members_prefs():
from zope.component import getUtility
from mailman.interfaces.listmanager import IListManager
from mailman.interfaces.member import DeliveryMode, DeliveryStatus
hide_address = False
delivery_status = DeliveryStatus.enabled
lm = getUtility(IListManager)
for mlist in lm.mailing_lists:
print(f"... members in {mlist.fqdn_listname}")
for member in mlist.members.members:
prefs = member.preferences
prefs.acknowledge_posts = True
prefs.hide_address = hide_address
prefs.preferred_language = 'de'
prefs.receive_list_copy = True
prefs.receive_own_postings = True
prefs.delivery_mode = DeliveryMode.regular
prefs.delivery_status = delivery_status
print(f"Updated {member.address.email} in list {mlist.fqdn_listname}")
_______________________________________________
Mailman-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at:
https://lists.mailman3.org/archives/list/[email protected]/message/GKLCIIKFQMS5S7TQLQMQNTOYWGKXVHFP/
This message sent to [email protected]