My apologies. I misunderstood what you were trying to achieve.
Apologies for the noise :-)
On Mon, 7 Feb 2022, 11:57 Duane Raymond, <duane@fairsay.com> wrote:
On Mon, 7 Feb 2022 at 08:46, Philip Colmer <philip.colmer@linaro.org> wrote:
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...
Perhaps I misunderstood, but this seems to focus on the email message templates, and not html Postorius and Hyperkitty templates....or were you suggesting I adapt the script below for use with patches and Postorius and Hyperkitty templates? Seems like a plausible idea of the django template method Abhilash Raj pointed me to doesn't work.
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.
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/