On 10/29/21 3:41 AM, Wolfgang Bock via Mailman-users wrote:
the question is: postgres - mailman3web-postorius_emailtemplate table vs mailman3 - templates table
I installed a brand new mailman3 with mailman Core 3.3.3, Api 3.1, Core Python 3.9.2 postgres12 nginx on debian bullseye.
I created a template via postorius -> lists -> (testliste01) -> templates -> new template -> [list:member:regular:footer] and [list:member:digest:footer]
They are shown in the postgres database mailman3 table templates: id name context uri username password 14 list:member:digest:footer testliste01.mydomain.de http://localhost/postorius/api/templates/list/testliste01.mydomain.de/list:m ember:digest:footer 15 list:member:regular:footer testliste01.mydomain.de http://localhost/postorius/api/templates/list/testliste01.mydomain.de/list:m ember:regular:footer
First there where no templates in the /var/lib/mailman3/templates folder, which was empty after installation.
This is expected. That is one place where you can put custom templates.
Later I created in /var/lib/mailman3/templates theses folders and the files /list/testliste01.mydomain.de/list:member:digest:footer + list:member:regular:footer owned by list:list 644
A testmail went through but instead of the default footer no footer was shown.
By default Mailman searches for templates first in the var/templates directory and then in the templates directory in the Mailman installation. The details are described at https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/utilities/i18n.....
However, the default search is only applied if there is matching entry
for the template name and context in the templates
table in the
database or if the uri in the entry is a mailman://
uri.
When you create a template in Postorius, that uri becomes something like
https://example.com/mailman3/api/templates/list/<list_id>/<template_name>
which basically says get the template from Postorius, and the template
if any in var/templates is ignored.
In the sys.log I found the following error message: Oct 29 11:28:04 myserver mailman3[33015]: Message:
Cannot retrieve template at http://localhost/postorius/api/templates/list/testliste01.mydomain.de/list:m ember:regular:footer (<no authorization>)
So Mailman is trying to get the Postorius template. What is in the web server logs for this retrieval?
How can I solve this problem? What kind of authorisation is meant? list? restadmin?
I read in https://docs.mailman3.org/en/latest/config-core.html#configure-templates ... list specific templates invar/templates/lists/LIST-ID/LC/ ... I guess the LC means Language Code. But in the database table templates no LC subdirectory is mentioned (in my case must be de).
If you delete the Postorius template, The entry in the templates table will be removed and the search will revert to var/templates, etc.
And I read (dont know where) .... The templates created in Postorius are created in the postorius_emailtemplate table in Mailman
s database and referenced via URLs like
https://example.com/mailman3/api/templates/list/<list-id>/<template-name>`. I.e., they are not stored in the file system. ...That`s true. I found in postgres database mailman3web in the table mailman3web postorius_emailtemplate my
id name data language created_at modified_at context identifier 15 list:member:digest:footer postorius footer digest 1x linefeed 2021-10-29 11:17:40.664689+02 2021-10-29 11:26:48.692628+02 list testliste01.mydomain.de 16 list:member:regular:footer postorius footer non-digest 1x linefeed 2021-10-29 11:18:29.166241+02 2021-10-29 11:27:24.519024+02 list testliste01.mydomain.de
But my question is how to integrate this into the mailman3-system. The language isn`t set either.
It is integrated. The language isn`t set because you are getting the template from Postorius and Postorius knows the language.
On 10/31/21 4:13 AM, Wolfgang Bock via Mailman-users wrote:
regarding my mail before, here an additional information.
I can show the templates with following command (anonymized):
https://active_domain.de/postorius/api/templates/list/testliste01.active_dom...
As it should be.
The complete syslog
(edited and reformatted by me)
> --- Logging error ---
> Traceback (most recent call last): Oct 30 11:49:52 active_server
mailman3[107630]: File
"/usr/lib/python3/dist-packages/mailman/model/template.py", line 110, in get
> contents = protocols.get(actual_uri, **auth)
> File
"/usr/lib/python3/dist-packages/mailman/utilities/protocols.py", line
39, in get
> response.raise_for_status()
> File "/usr/lib/python3/dist-packages/requests/models.py", line
943, in raise_for_status
> raise HTTPError(http_error_msg, response=self)
> requests.exceptions.HTTPError: 404 Client Error: Not Found for url:
http://localhost/postorius/api/templates/list/testliste01.active_domain.de/list:member:regular:footer
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
> File "/usr/lib/python3.9/logging/__init__.py", line 430, in format
> return self._format(record)
> File "/usr/lib/python3.9/logging/__init__.py", line 426, in _format
> return self._fmt % record.__dict__
> KeyError: `t`
> During handling of the above exception, another exception occurred:
Your template is malformed. You have $ strings that are not defined as Mailman substitution variables. See https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/t...
-- Mark Sapiro <mark(a)msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan