Move list config into "config" and don't config lists when absent

This commit is contained in:
Adam Goldsmith 2023-02-03 14:01:41 -05:00
parent 848c98c456
commit 2e612837c7

View File

@ -3,12 +3,14 @@
"""
Update Mailman 2 lists via a json API of the form:
{
"LIST": {
"real_name": "REAL_NAME",
"moderator": ["ADDRESS", ...],
"subject_prefix": "PREFIX",
"reply_to_address": "REPLY_TO_ADDRESS",
"members": ["ADDRESS", ...]
LIST: {
"config"?: {
"real_name": REAL_NAME,
"moderator": [ADDRESS, ...],
"subject_prefix": PREFIX,
"reply_to_address": REPLY_TO_ADDRESS,
}
"members": [ADDRESS, ...]
},
...
}
@ -90,7 +92,7 @@ class ListManager:
"new_member_options = 272",
"advertised = 0",
"subscribe_policy = 3", # require approval to join
"unsubscribe_policy = 1", # require approval to unsubscribe
"unsubscribe_policy = 1", # require approval to unsubscribe
"private_roster = 2", # only admins can view the roster
"default_member_moderation = 1",
"generic_nonmember_action = 3", # discard non-member emails
@ -161,14 +163,11 @@ def main(
else:
list_manager.newlist(urlhost, emailhost, admin)
print(f"Configuring/syncing {list_name}...")
list_manager.config_list(
emailhost,
props["real_name"],
props["moderator"],
props["subject_prefix"],
props["reply_to_address"],
)
if "config" in props:
print(f"Configuring/syncing {list_name}...")
list_manager.config_list(emailhost, **props["config"])
else:
print("Not configuring {list_name}, as it has no config section")
list_manager.sync_members(props["members"])