7 Feb
2022
7 Feb
'22
7:46 a.m.
The REST API provides a means to customise templates on a list, domain or site context.
https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/t...
We use a very simple script that takes a text file from the current directory and, when run locally on a MM3 server, uses the REST API to update the template on a site context, thus affecting all lists and all domains on the same server.
from mailman.testing.documentation import call_http
def update_template(template_name, template_file):
""" Update the specified template """
print("Updating", template_name)
call_http(
'http://localhost:8001/3.1/uris',
{
template_name: template_file
},
method='PATCH',
username="restadmin",
password="restpass"
)
update_template(
"list:admin:action:post",
"file:///home/ubuntu/mm3-templates/list:admin:action:post.txt"
)
The API documentation lists out the various template names that can be used.