Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
728774e2 by Mark Sapiro at 2023-01-30T19:51:47+00:00
Allow setting Postfix transport_file_type: regex without setting something for 
postmap_command:.

Fixes #1058

* Allow setting Postfix transport_file_type: regex without setting something
for postmap_command:.

- - - - -
3d05d6a9 by Mark Sapiro at 2023-01-30T19:51:48+00:00
Merge branch 'mta' into 'master'

Allow setting Postfix transport_file_type: regex without setting something for 
postmap_command:.

Closes #1058

See merge request mailman/mailman!1095

Merged-by: Mark Sapiro <m...@msapiro.net>

Reviewed-by: 
- - - - -


4 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/mta/postfix.py
- + src/mailman/mta/tests/data/postfix.cfg
- + src/mailman/mta/tests/test_postfix.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -26,6 +26,8 @@ Bugs fixed
   (Closes #1053)
 * The master process now robustly detects when runner processes
   terminate and restarts them (Closes #898).
+* Setting Postfix transport_file_type: regex without setting something for
+  postmap_command: no longer throws an exception.  (Closes #1058)
 
 .. _news-3.3.8:
 


=====================================
src/mailman/mta/postfix.py
=====================================
@@ -84,9 +84,10 @@ class LMTP:
     def __init__(self):
         # Locate and read the Postfix specific configuration file.
         mta_config = external_configuration(config.mta.configuration)
-        self.postmap_command = mta_config.get('postfix', 'postmap_command')
         self.transport_file_type = mta_config.get(
             'postfix', 'transport_file_type')
+        if self.transport_file_type == 'hash':
+            self.postmap_command = mta_config.get('postfix', 'postmap_command')
 
     def create(self, mlist):
         """See `IMailTransportAgentLifecycle`."""


=====================================
src/mailman/mta/tests/data/postfix.cfg
=====================================
@@ -0,0 +1,2 @@
+[postfix]
+transport_file_type: regex


=====================================
src/mailman/mta/tests/test_postfix.py
=====================================
@@ -0,0 +1,37 @@
+# Copyright (C) 2014-2023 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman.  If not, see <http://www.gnu.org/licenses/>.
+
+"""Test Postfix config."""
+
+import unittest
+
+from mailman.config import config
+from mailman.mta.postfix import LMTP
+from mailman.testing.layers import ConfigLayer
+
+
+class TestPostfixConfig(unittest.TestCase):
+    layer = ConfigLayer
+
+    def test_regex_config(self):
+        config.push('regex_config', """\
+[mta]
+configuration: python:mailman.mta.tests.data.postfix
+""")
+        lmtp = LMTP()
+        self.assertEqual('regex', lmtp.transport_file_type)
+        config.pop('regex_config')



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/2e3555732f6aa8d5035772952fcefdac5509161d...3d05d6a97469bcf0abe24f8e0c0cccd33f5462a3

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/2e3555732f6aa8d5035772952fcefdac5509161d...3d05d6a97469bcf0abe24f8e0c0cccd33f5462a3
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to