summaryrefslogtreecommitdiff
path: root/src/mailman/mta/postfix.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-01-27 18:30:03 -0500
committerBarry Warsaw2012-01-27 18:30:03 -0500
commit78b9ea398e6671d94f958e625b640383f1d43a75 (patch)
tree8570a4109d5eec6c2f0ab201d8fd8177558e6682 /src/mailman/mta/postfix.py
parent1655fcc1e8d1cb2e9ee19288c026c85b3b470a97 (diff)
downloadmailman-78b9ea398e6671d94f958e625b640383f1d43a75.tar.gz
mailman-78b9ea398e6671d94f958e625b640383f1d43a75.tar.zst
mailman-78b9ea398e6671d94f958e625b640383f1d43a75.zip
Diffstat (limited to 'src/mailman/mta/postfix.py')
-rw-r--r--src/mailman/mta/postfix.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mailman/mta/postfix.py b/src/mailman/mta/postfix.py
index 171e0737b..14f19635a 100644
--- a/src/mailman/mta/postfix.py
+++ b/src/mailman/mta/postfix.py
@@ -45,6 +45,16 @@ ALIASTMPL = '{0:{2}}lmtp:[{1.mta.lmtp_host}]:{1.mta.lmtp_port}'
+class _FakeList:
+ """Duck-typed list for the `IMailTransportAgentAliases` interface."""
+
+ def __init__(self, list_name, mail_host):
+ self.list_name = list_name
+ self.mail_host = mail_host
+ self.posting_address = '{0}@{1}'.format(list_name, mail_host)
+
+
+
class LMTP:
"""Connect Mailman to Postfix via LMTP."""
@@ -102,8 +112,10 @@ class LMTP:
"""Do the actual file writes for list creation."""
# Sort all existing mailing list names first by domain, then by local
# part. For postfix we need a dummy entry for the domain.
+ list_manager = getUtility(IListManager)
by_domain = {}
- for mlist in getUtility(IListManager).mailing_lists:
+ for list_name, mail_host in list_manager.name_components:
+ mlist = _FakeList(list_name, mail_host)
by_domain.setdefault(mlist.mail_host, []).append(mlist)
print >> fp, """\
# AUTOMATICALLY GENERATED BY MAILMAN ON {0}