diff options
| author | Barry Warsaw | 2009-01-01 21:04:08 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-01-01 21:04:08 -0500 |
| commit | c0522afd1754c7a18c40c9ebaa6c2ef406929170 (patch) | |
| tree | 863622ee9a566f4a5f7a37ec03a4ac3319adb3ca /mailman/MTA/Utils.py | |
| parent | 2aba849464a5d0ab25d08b92995c565056b531e4 (diff) | |
| download | mailman-c0522afd1754c7a18c40c9ebaa6c2ef406929170.tar.gz mailman-c0522afd1754c7a18c40c9ebaa6c2ef406929170.tar.zst mailman-c0522afd1754c7a18c40c9ebaa6c2ef406929170.zip | |
move directory
Diffstat (limited to 'mailman/MTA/Utils.py')
| -rw-r--r-- | mailman/MTA/Utils.py | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/mailman/MTA/Utils.py b/mailman/MTA/Utils.py deleted file mode 100644 index bebbc69b7..000000000 --- a/mailman/MTA/Utils.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2001-2009 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/>. - -"""Utilities for list creation/deletion hooks.""" - -import os -import pwd - -from mailman.configuration import config - - - -def getusername(): - username = os.environ.get('USER') or os.environ.get('LOGNAME') - if not username: - import pwd - username = pwd.getpwuid(os.getuid())[0] - if not username: - username = '<unknown>' - return username - - - -def _makealiases_mailprog(mlist): - wrapper = os.path.join(config.WRAPPER_DIR, 'mailman') - # Most of the list alias extensions are quite regular. I.e. if the - # message is delivered to listname-foobar, it will be filtered to a - # program called foobar. There are two exceptions: - # - # 1) Messages to listname (no extension) go to the post script. - # 2) Messages to listname-admin go to the bounces script. This is for - # backwards compatibility and may eventually go away (we really have no - # need for the -admin address anymore). - # - # Seed this with the special cases. - listname = mlist.internal_name() - fqdn_listname = mlist.fqdn_listname - aliases = [ - (listname, '"|%s post %s"' % (wrapper, fqdn_listname)), - ] - for ext in ('admin', 'bounces', 'confirm', 'join', 'leave', 'owner', - 'request', 'subscribe', 'unsubscribe'): - aliases.append(('%s-%s' % (listname, ext), - '"|%s %s %s"' % (wrapper, ext, fqdn_listname))) - return aliases - - - -def _makealiases_maildir(mlist): - maildir = config.MAILDIR_DIR - listname = mlist.internal_name() - fqdn_listname = mlist.fqdn_listname - if not maildir.endswith('/'): - maildir += '/' - # Deliver everything using maildir style. This way there's no mail - # program, no forking and no wrapper necessary! - # - # Note, don't use this unless your MTA leaves the envelope recipient in - # Delivered-To:, Envelope-To:, or Apparently-To: - aliases = [(listname, maildir)] - for ext in ('admin', 'bounces', 'confirm', 'join', 'leave', 'owner', - 'request', 'subscribe', 'unsubscribe'): - aliases.append(('%s-%s' % (listname, ext), maildir)) - return aliases - - - -# XXX This won't work if Mailman.MTA.Utils is imported before the -# configuration is loaded. -if config.USE_MAILDIR: - makealiases = _makealiases_maildir -else: - makealiases = _makealiases_mailprog |
