Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: d507a90a by Abhilash Raj at 2020-03-08T23:22:21-07:00 Fix the TemplateLoader for the new API in importlib_resources. - - - - - 98274cbd by Mark Sapiro at 2020-03-09T13:29:51+00:00 Merge branch 'fix-660' into 'master' Fix the TemplateLoader for the new API in importlib_resources. Closes #691 See merge request mailman/mailman!605 - - - - - 5 changed files: - setup.py - src/mailman/docs/NEWS.rst - src/mailman/utilities/i18n.py - src/mailman/utilities/tests/test_modules.py - src/mailman/utilities/tests/test_templates.py Changes: ===================================== setup.py ===================================== @@ -115,7 +115,7 @@ case second 'm'. Any other spelling is incorrect.""", 'flufl.bounce', 'flufl.i18n>=2.0', 'flufl.lock>=3.1', - 'importlib_resources', + 'importlib_resources>=1.1.0', 'gunicorn', 'lazr.config', 'python-dateutil>=2.0', ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -46,6 +46,8 @@ Bugs that can't be flattened as_bytes. (Closes #677) * Removed an incorrect failing assertion when confirming a confirm_then_moderate unsubscription. (Closes #553) +* Fix a bug due to incompatible API of a new version of ``importlib_resources`` + library which causes Templates loading to fail. (Closes #691) REST ---- ===================================== src/mailman/utilities/i18n.py ===================================== @@ -21,7 +21,7 @@ import os import sys from contextlib import ExitStack -from importlib_resources import path +from importlib_resources import files from itertools import product from mailman.config import config from mailman.core.constants import system_preferences @@ -114,7 +114,7 @@ def search(resources, template_file, mlist=None, language=None): languages.append(language) languages.reverse() # The non-language qualified $template_dir paths in search order. - templates_dir = str(resources.enter_context(path('mailman', 'templates'))) + templates_dir = str(resources.enter_context(files('mailman.templates'))) paths = [templates_dir, os.path.join(config.TEMPLATE_DIR, 'site')] if mlist is not None: # Don't forget these are in REVERSE search order! ===================================== src/mailman/utilities/tests/test_modules.py ===================================== @@ -22,7 +22,7 @@ import sys import unittest from contextlib import ExitStack, contextmanager -from importlib_resources import path +from importlib_resources import files from mailman.interfaces.rules import IRule from mailman.interfaces.styles import IStyle from mailman.testing.helpers import configuration @@ -162,7 +162,7 @@ class AbstractStyle: def test_find_pluggable_components_by_plugin_name(self): with ExitStack() as resources: testing_path = resources.enter_context( - path('mailman.plugins.testing', '')) + files('mailman.plugins.testing')) resources.enter_context(hack_syspath(0, str(testing_path))) resources.enter_context(configuration('plugin.example', **{ 'class': 'example.hooks.ExamplePlugin', @@ -174,7 +174,7 @@ class AbstractStyle: def test_find_pluggable_components_by_component_package(self): with ExitStack() as resources: testing_path = resources.enter_context( - path('mailman.plugins.testing', '')) + files('mailman.plugins.testing')) resources.enter_context(hack_syspath(0, str(testing_path))) resources.enter_context(configuration('plugin.example', **{ 'class': 'example.hooks.ExamplePlugin', ===================================== src/mailman/utilities/tests/test_templates.py ===================================== @@ -23,7 +23,7 @@ import tempfile import unittest from contextlib import ExitStack -from importlib_resources import path as resource_path +from importlib_resources import files as resource_path from mailman.app.lifecycle import create_list from mailman.config import config from mailman.interfaces.languages import ILanguageManager @@ -64,7 +64,7 @@ class TestSearchOrder(unittest.TestCase): # /m/ as the root. with ExitStack() as resources: in_tree = str(resources.enter_context( - resource_path('mailman', 'templates')).parent) + resource_path('mailman.templates')).parent) raw_search_order = search( resources, template_file, mailing_list, language) for path in raw_search_order: View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/1baf751778835692dd71d0b594c6e6caeab876cb...98274cbd03e9180e5180584ffa9f4c09396d62ef -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/1baf751778835692dd71d0b594c6e6caeab876cb...98274cbd03e9180e5180584ffa9f4c09396d62ef You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org