Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
7f30d510 by Mark Sapiro at 2022-03-18T10:23:35-07:00
Don't create unnecessary template table entries for imported templates.
- - - - -
000c56e4 by Mark Sapiro at 2022-03-18T21:42:14+00:00
Merge branch 'import' into 'master'
Don't create unnecessary template table entries for imported templates.
Closes #988
See merge request mailman/mailman!989
- - - - -
2 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/utilities/importer.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -48,6 +48,8 @@ Bugs fixed
* The i18n gettext replacements now all use curly brace notation to avoid
issues whith translations that might follow them immediately with a period.
The various mailman.po files have been updated accordingly. (Closes #987)
+* The ``mailman import21`` command no longer creates unnecessary entries in the
+ ``template`` table. (Closes #988)
REST
====
=====================================
src/mailman/utilities/importer.py
=====================================
@@ -48,7 +48,7 @@ from mailman.interfaces.mailinglist import (
)
from mailman.interfaces.member import DeliveryMode, DeliveryStatus, MemberRole
from mailman.interfaces.nntp import NewsgroupModeration
-from mailman.interfaces.template import ITemplateLoader, ITemplateManager
+from mailman.interfaces.template import ITemplateLoader
from mailman.interfaces.usermanager import IUserManager
from mailman.model.roster import RosterVisibility
from mailman.utilities.filesystem import makedirs
@@ -468,7 +468,7 @@ def import_config_pck(mlist, config_dict):
# special `mailman:` scheme indicating a file system path. What we do
# here is look to see if the list's decoration is different than the
# default, and if so, we'll write the new decoration template to a
- # `mailman:` scheme path, then add the template to the template manager.
+ # `mailman:` scheme path which is in the standard search path.
# We are intentionally omitting the 2.1 welcome_msg here because the
# string is actually interpolated into a larger template and there's
# no good way to figure where in the default template to insert it.
@@ -493,7 +493,6 @@ def import_config_pck(mlist, config_dict):
('%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s\n', ''),
]
# Collect defaults.
- manager = getUtility(ITemplateManager)
defaults = {}
for oldvar, newvar in convert_to_uri.items():
default_value = getUtility(ITemplateLoader).get(newvar, mlist)
@@ -541,11 +540,8 @@ def import_config_pck(mlist, config_dict):
expanded_text.strip() == default_text.strip()):
# Keep the default.
continue
- # Write the custom value to the right file and add it to the template
- # manager for real.
- base_uri = 'mailman:///$listname/$language/'
+ # Write the custom value to the right file.
filename = '{}.txt'.format(newvar)
- manager.set(newvar, mlist.list_id, base_uri + filename)
with ExitStack() as resources:
filepath = list(search(resources, filename, mlist))[0]
makedirs(os.path.dirname(filepath))
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/169ea24abb297d6602c651639fd013afbac76bac...000c56e42ec4d5e1da6e8174de41031a3d2ad387
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/169ea24abb297d6602c651639fd013afbac76bac...000c56e42ec4d5e1da6e8174de41031a3d2ad387
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: [email protected]