summaryrefslogtreecommitdiff
path: root/src/mailman/config
diff options
context:
space:
mode:
authorBarry Warsaw2016-01-11 22:52:33 -0500
committerBarry Warsaw2016-01-11 22:52:33 -0500
commit03bb57c8c2a47a08e19b20975622ebb2ef2b81c6 (patch)
tree332bf1e5e36da0a3cb4271b1a471a62865071a62 /src/mailman/config
parent58ee14bfb1c1c24d06fb0509e42e06e37a505479 (diff)
downloadmailman-03bb57c8c2a47a08e19b20975622ebb2ef2b81c6.tar.gz
mailman-03bb57c8c2a47a08e19b20975622ebb2ef2b81c6.tar.zst
mailman-03bb57c8c2a47a08e19b20975622ebb2ef2b81c6.zip
Several optimizations:
* Use `yield from` wherever appropriate. * Use SA's .one_or_none() where appropriate. - Fix a bug in MailingList.pass_extensions. - Use ValueError in other places for consistency. - Remove unreached/nonsense code. - Simplify the SubscriptionService.find_member() and .find_members() implementations. - Boost coverage.
Diffstat (limited to 'src/mailman/config')
-rw-r--r--src/mailman/config/config.py6
-rw-r--r--src/mailman/config/tests/test_configuration.py15
2 files changed, 17 insertions, 4 deletions
diff --git a/src/mailman/config/config.py b/src/mailman/config/config.py
index 69ddfb04f..424ad03c0 100644
--- a/src/mailman/config/config.py
+++ b/src/mailman/config/config.py
@@ -245,8 +245,7 @@ class Configuration:
@property
def runner_configs(self):
"""Iterate over all the runner configuration sections."""
- for section in self._config.getByCategory('runner', []):
- yield section
+ yield from self._config.getByCategory('runner', [])
@property
def archivers(self):
@@ -262,8 +261,7 @@ class Configuration:
@property
def language_configs(self):
"""Iterate over all the language configuration sections."""
- for section in self._config.getByCategory('language', []):
- yield section
+ yield from self._config.getByCategory('language', [])
diff --git a/src/mailman/config/tests/test_configuration.py b/src/mailman/config/tests/test_configuration.py
index 48cf21983..abbfce2c2 100644
--- a/src/mailman/config/tests/test_configuration.py
+++ b/src/mailman/config/tests/test_configuration.py
@@ -58,6 +58,21 @@ class TestConfiguration(unittest.TestCase):
pass
self.assertEqual(events, ['first', 'second', 'first'])
+ def test_config_template_dir_is_source(self):
+ fd, filename = tempfile.mkstemp()
+ self.addCleanup(os.remove, filename)
+ os.close(fd)
+ with open(filename, 'w') as fp:
+ print("""\
+[paths.here]
+template_dir: :source:
+""", file=fp)
+ config = Configuration()
+ config.load(filename)
+ import mailman.templates
+ self.assertEqual(config.TEMPLATE_DIR,
+ os.path.dirname(mailman.templates.__file__))
+
class TestExternal(unittest.TestCase):