summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-05-10 22:34:38 +0000
committerbwarsaw2001-05-10 22:34:38 +0000
commit65185a173d68cc1a218951702b53f4167d86d1bb (patch)
treeb7d96f4b6817807bb7b9ba8e5c68d110d0411e6f
parent08eebcc9c4562bb2e9e7a9c879d6ba4c4ff3b719 (diff)
downloadmailman-65185a173d68cc1a218951702b53f4167d86d1bb.tar.gz
mailman-65185a173d68cc1a218951702b53f4167d86d1bb.tar.zst
mailman-65185a173d68cc1a218951702b53f4167d86d1bb.zip
intermediate
-rw-r--r--Mailman/MTA/Utils.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/Mailman/MTA/Utils.py b/Mailman/MTA/Utils.py
new file mode 100644
index 000000000..1dac4b80d
--- /dev/null
+++ b/Mailman/MTA/Utils.py
@@ -0,0 +1,46 @@
+# Copyright (C) 2001 by the Free Software Foundation, Inc.
+#
+# This program 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 2
+# of the License, or (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""Utilities for list creation/deletion hooks."""
+
+import os
+import pwd
+
+from Mailman import mm_cfg
+
+
+
+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(listname):
+ wrapper = os.path.join(mm_cfg.WRAPPER_DIR, 'wrapper')
+ return (
+ (listname, '"|%s post %s"' % (wrapper, listname)),
+ (listname + '-admin', '"|%s mailowner %s"' % (wrapper, listname)),
+ (listname + '-request', '"|%s mailcmd %s"' % (wrapper, listname)),
+ (listname + '-join', '"|%s join %s"' % (wrapper, listname)),
+ (listname + '-leave', '"|%s leave %s"' % (wrapper, listname)),
+ (listname + '-owner', '%s-admin' % listname),
+ )