summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1998-06-19 19:47:24 +0000
committerbwarsaw1998-06-19 19:47:24 +0000
commit377556845b20f86b61df073fc41bec71b586aaca (patch)
tree9fb27074f47564148986b93925a87a846485cbbf
parent8d1ec3ae14fcc935284c2fff960265d234ed54e2 (diff)
downloadmailman-377556845b20f86b61df073fc41bec71b586aaca.tar.gz
mailman-377556845b20f86b61df073fc41bec71b586aaca.tar.zst
mailman-377556845b20f86b61df073fc41bec71b586aaca.zip
Use the new packagized modules
-rwxr-xr-xbin/convert_list93
-rwxr-xr-xbin/mmsitepass4
-rwxr-xr-xbin/newlist70
-rwxr-xr-xbin/populate_new_list15
4 files changed, 76 insertions, 106 deletions
diff --git a/bin/convert_list b/bin/convert_list
index 6722be734..bdca7441f 100755
--- a/bin/convert_list
+++ b/bin/convert_list
@@ -23,65 +23,60 @@
# Make sure that the list of email addresses doesn't contain any comments,
# like majordomo may throw in. For now, you just have to remove them manually.
-import sys, os, crypt, string
-import paths # path hacking
-import maillist, mm_utils, mm_message, mm_cfg
+"""Convert a list.
+Usage:
+ convert_list <list name> <non-digest-members-file> <digest-members-file>
+"""
+
+import sys
+import os
+import string
+import paths
+import Mailman.MailList
+import Mailman.Utils
+import Mailman.Message
+import Mailman.mm_cfg
+
+
+def usage(status, msg=''):
+ if msg:
+ print msgne
+ print __doc__ % globals()
+ sys.exit(status)
def GetRandomPassword():
- return "%s%s" % (mm_utils.GetRandomSeed(), mm_utils.GetRandomSeed())
+ seed1 = Mailman.Utils.GetRandomPassword()
+ seed2 = Mailman.Utils.GetRandomPassword()
+ return "%s%s" % (seed1, seed2)
+
def SendExplanation(users):
- msg = mm_message.OutgoingMessage()
+ msg = Mailman.Message.OutgoingMessage()
msg.SetSender(list.GetAdminEmail())
- msg.SetHeader('subject', ('Big change in %s@%s mailing list'
- % (list.real_name, list.host_name)))
- # Yuck, a quick macro, undo this soon.
- ma = msg.AppendToBody
- ma('The %s mailing list has just undergone a big change.\n'
- % list.real_name)
- ma('It is running on a new mailing list package called "Mailman".\n')
- ma('This will hopefully solve a lot of problems that administering\n')
- ma('this list has presented.\n\n')
- ma('How does this affect you??\n')
- ma('1) Mail intended for the whole list should be sent to:\n')
- ma('\t%s\n\n' % list.GetListEmail())
- ma('2) You have been given an arbitrary password to prevent others\n')
- ma(' from unsubscribing you from this mailing list. It will be\n')
- ma(' mailed to you in a separate mail, which you may have already\n')
- ma(' received. YOU DON\'T HAVE TO REMEMBER THIS PASSWORD.\n')
- ma(' A reminder will be sent to you via email every month.\n')
- ma('3) If you have World Wide Web access, you can use it at any time\n')
- ma(' to unsubscribe at any time, to switch to and from digest mode,\n')
- ma(' to check back issues of the list (which will be available after\n')
- ma(' the list has been getting posts for a day or so).\n')
- ma(' The Web address for these resources is:\n')
- ma('\t\t%s\n\n' % list.GetAbsoluteScriptURL('listinfo'))
- ma('4) If you do not have WWW access, you can do these same things via\n')
- ma(' email. Send mail to:\n')
- ma('\t\t%s\n\n' % list.GetRequestEmail())
- ma(' With a subject or body of:\n')
- ma('\t\thelp\n\n')
- ma(' You will receive an automated reply giving you further directions.')
- ma('\n\nPlease address any questions or problems with this new setup to:\n')
- ma('\t%s\n\n' % list.GetAdminEmail())
- ma('(This mail was auto-generated by Mailman %s)\n' % mm_cfg.VERSION)
-
+ dict = {'listname' : list.real_name,
+ 'listhost' : list.host_name,
+ 'listaddr' : list.GetListEmail(),
+ 'listinfo_url': list.GetAbsoluteScriptURL('listinfo'),
+ 'requestaddr' : list.GetRequestEmail(),
+ 'adminaddr' : list.GetAdminEmail(),
+ 'version' : Mailman.mm_cfg.VERSION,
+ }
+ header = 'Big change in %(listname)s@%(listhost) mailing list' % dict
+ msg.SetHeader('subject', header)
+ msg.AppendToBody(Mailman.Utils.maketext('convert.txt', dict))
list.DeliverToList(msg, users, None, None)
-if len(sys.argv) <> 4:
- print ('Usage: convert_list <list name> <non-digest-members-file> '
- '<digest-members-file>')
- sys.exit(0)
-
-try:
- list = maillist.MailList(sys.argv[1])
-except:
- print 'run newlist first...'
- sys.exit(0)
+def main():
+ if len(sys.argv) <> 4:
+ usage(1)
+ try:
+ list = maillist.MailList(sys.argv[1])
+ except:
+ usage(1, 'You must first run: newlist ' + sys.argv[1])
try:
non_digest_members = string.split(open(sys.argv[2]).read(), '\n')
@@ -96,7 +91,7 @@ except:
def FormatMembers(mbrs):
def NotNull(str):
- return str
+ return str
return filter(NotNull, map(string.strip, mbrs))
non_digest_members = FormatMembers(non_digest_members)
diff --git a/bin/mmsitepass b/bin/mmsitepass
index 30b71773b..ec300693c 100755
--- a/bin/mmsitepass
+++ b/bin/mmsitepass
@@ -24,13 +24,13 @@ places that a list users password can be used."""
import sys
import paths
-import maillist
+from Mailman import MailList
def main(argv):
if len(sys.argv) != 2:
print "Usage: mmsitepass password"
raise SystemExit, 1
- l = maillist.MailList()
+ l = MailList.MailList()
l.SetSiteAdminPassword(sys.argv[1])
if l.CheckSiteAdminPassword(sys.argv[1]):
print "Password changed."
diff --git a/bin/newlist b/bin/newlist
index c12ae596b..36ede674c 100755
--- a/bin/newlist
+++ b/bin/newlist
@@ -26,10 +26,13 @@ immediately. Otherwise, the script hangs pending input, to give time for
the person creating the list to customize it before sending the admin an
email notice about the existence of the new list."""
-import sys, crypt, os, string
+import sys, os, string
import time
-import paths
-import maillist, mm_utils, mm_cfg
+import paths # path hacking
+from Mailman import MailList
+from Mailman import Utils
+from Mailman import mm_cfg
+from Mailman.Crypt import crypt
ADDALIASES_CMD = paths.prefix + '/bin/addaliases'
@@ -55,7 +58,7 @@ def main(argv):
sys.stderr.write(" (It's the list name, not address.)\n")
return 1
- if list_name in mm_utils.list_names():
+ if list_name in Utils.list_names():
sys.stderr.write("** List with name %s already exists\n" % `list_name`)
return 1
@@ -69,8 +72,8 @@ def main(argv):
else:
list_pw = raw_input("Enter the initial list password: ")
- newlist = maillist.MailList()
- pw = crypt.crypt(list_pw , mm_utils.GetRandomSeed())
+ newlist = MailList.MailList()
+ pw = crypt(list_pw , Utils.GetRandomSeed())
newlist.Create(list_name, owner_mail, pw)
###os.system('%s %s' % (ADDALIASES_CMD, list_name))
@@ -100,54 +103,23 @@ Entry for aliases file:
% list_name),
sys.stdin.readline()
sendnotice(newlist, list_name, owner_mail, list_pw)
+ newlist.Unlock()
+
def sendnotice(newlist, list_name, owner_mail, list_pw):
+ text = Utils.maketext(
+ 'newlist.txt',
+ {'listname' : list_name,
+ 'password' : list_pw,
+ 'admin_url' : newlist.GetAbsoluteScriptURL('admin'),
+ 'listinfo_url': newlist.GetAbsoluteScriptURL('listinfo'),
+ 'requestaddr' : "%s-request@%s" % (list_name, newlist.host_name),
+ 'hostname' : newlist.host_name,
+ })
newlist.SendTextToUser(subject="Your new mailing list",
recipient=owner_mail,
sender='mailman-owner@%s' % newlist.host_name,
- text="""\
-The mailing list `%s' has just been created for you. The following is some
-basic information about your mailing list.
-
-Your mailing list password is:
-
- %s
-
-You need this password to configure your mailing list. You also need it to
-handle administrative requests, such as approving mail if you choose to run
-a moderated list.
-
-You can configure your mailing list at the following web page:
-
- %s
-
-The web page for users of your mailing list is:
-
- %s
-
-You can even customize these web pages from the list configuration page.
-However, you do need to know HTML to be able to do this.
-
-There is also an email-based interface for users (not administrators) of your
-list; you can get info about using it by sending a message with just the word
-`help' as subject or in the body, to:
-
- %s
-
-To unsubscribe a user: from the mailing list 'listinfo' web page, click on
-or enter the user's email address as if you were that user. Where that
-user would put in their password to unsubscribe, put in your admin
-password. You can also use your password to change member's options,
-including digestification, delivery disabling, etc.
-
-Please address all questions to mailman-owner@%s.
-""" % (list_name, list_pw,
- newlist.GetAbsoluteScriptURL('admin'),
- newlist.GetAbsoluteScriptURL('listinfo'),
- "%s-request@%s" % (list_name, newlist.host_name),
- newlist.host_name))
-
-newlist.Unlock()
+ text=text)
if __name__ == "__main__":
raise SystemExit(main(sys.argv))
diff --git a/bin/populate_new_list b/bin/populate_new_list
index f15560f5e..7cc5fd886 100755
--- a/bin/populate_new_list
+++ b/bin/populate_new_list
@@ -28,10 +28,13 @@ just email addrs, one per line."""
import sys, os, crypt, string
import paths
-import maillist, mm_utils, mm_message, mm_cfg, mm_err
+from Mailman import MailList
+from Mailman import Utils
+from Mailman import Errors
+
def GetRandomPassword():
- return "%s%s" % (mm_utils.GetRandomSeed(), mm_utils.GetRandomSeed())
+ return "%s%s" % (Utils.GetRandomSeed(), Utils.GetRandomSeed())
def main(argv):
if len(argv) not in [3, 4]:
@@ -40,8 +43,8 @@ def main(argv):
sys.exit(0)
try:
- list = maillist.MailList(sys.argv[1])
- except mm_err.MMUnknownListError, msg:
+ list = MailList.MailList(sys.argv[1])
+ except Errors.MMUnknownListError, msg:
sys.stderr.write("list %s not found\n" % `argv[1]`)
sys.exit(1)
@@ -75,7 +78,7 @@ def main(argv):
try:
list.ApprovedAddMember(member, pw, 0)
print "Regular member", member, "added"
- except mm_err.MMAlreadyAMember:
+ except Errors.MMAlreadyAMember:
sys.stderr.write("%s: %s already a member\n" %
(list.real_name, member))
@@ -84,7 +87,7 @@ def main(argv):
try:
list.ApprovedAddMember(member, pw, 1)
print "Digest member", member, "added"
- except mm_err.MMAlreadyAMember:
+ except Errors.MMAlreadyAMember:
sys.stderr.write("%s: %s already a member\n" %
(list.real_name, member))