aboutsummaryrefslogtreecommitdiffstats
path: root/bin/newlist
diff options
context:
space:
mode:
Diffstat (limited to 'bin/newlist')
-rwxr-xr-xbin/newlist53
1 files changed, 34 insertions, 19 deletions
diff --git a/bin/newlist b/bin/newlist
index c14b77f3..710109a6 100755
--- a/bin/newlist
+++ b/bin/newlist
@@ -1,6 +1,6 @@
#! @PYTHON@
#
-# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2016 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
@@ -41,6 +41,13 @@ Options:
their list has been created. This option suppresses the prompt and
notification.
+ -a/--automate
+ This option suppresses the prompt prior to administrator notification
+ but still sends the notification. It can be used to make newlist
+ totally non-interactive but still send the notification, assuming
+ listname, listadmin-addr and admin-password are all specified on the
+ command line.
+
-h/--help
Print this help text and exit.
@@ -84,8 +91,9 @@ where www.mydom.ain is used for `urlhost' but it will also be used for
'--urlhost' and '--emailhost' have precedence to this notation.
If you spell the list name as just `mylist', then the email hostname will be
-taken from DEFAULT_EMAIL_HOST and the url will be taken from DEFAULT_URL (as
-defined in your Defaults.py file or overridden by settings in mm_cfg.py).
+taken from DEFAULT_EMAIL_HOST and the url will be taken from DEFAULT_URL_HOST
+interpolated into DEFAULT_URL_PATTERN (as defined in your Defaults.py file or
+overridden by settings in mm_cfg.py).
Note that listnames are forced to lowercase.
"""
@@ -104,6 +112,7 @@ from Mailman import Message
from Mailman import i18n
_ = i18n._
+C_ = i18n.C_
PROGRAM = sys.argv[0]
@@ -114,7 +123,7 @@ def usage(code, msg=''):
fd = sys.stderr
else:
fd = sys.stdout
- print >> fd, _(__doc__)
+ print >> fd, C_(__doc__)
if msg:
print >> fd, msg
sys.exit(code)
@@ -123,21 +132,24 @@ def usage(code, msg=''):
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hql:u:e:',
- ['help', 'quiet', 'language=',
+ opts, args = getopt.getopt(sys.argv[1:], 'hqal:u:e:',
+ ['help', 'quiet', 'automate', 'language=',
'urlhost=', 'emailhost='])
except getopt.error, msg:
usage(1, msg)
lang = mm_cfg.DEFAULT_SERVER_LANGUAGE
- quiet = 0
+ quiet = False
+ automate = False
urlhost = None
emailhost = None
for opt, arg in opts:
if opt in ('-h', '--help'):
usage(0)
if opt in ('-q', '--quiet'):
- quiet = 1
+ quiet = True
+ if opt in ('-a', '--automate'):
+ automate = True
if opt in ('-l', '--language'):
lang = arg
if opt in ('-u', '--urlhost'):
@@ -147,12 +159,12 @@ def main():
# Is the language known?
if lang not in mm_cfg.LC_DESCRIPTIONS.keys():
- usage(1, _('Unknown language: %(lang)s'))
+ usage(1, C_('Unknown language: %(lang)s'))
if len(args) > 0:
listname = args[0]
else:
- listname = raw_input(_('Enter the name of the list: '))
+ listname = raw_input(C_('Enter the name of the list: '))
listname = listname.lower()
if '@' in listname:
@@ -167,22 +179,22 @@ def main():
web_page_url = mm_cfg.DEFAULT_URL_PATTERN % urlhost
if Utils.list_exists(listname):
- usage(1, _('List already exists: %(listname)s'))
+ usage(1, C_('List already exists: %(listname)s'))
if len(args) > 1:
owner_mail = args[1]
else:
owner_mail = raw_input(
- _('Enter the email of the person running the list: '))
+ C_('Enter the email of the person running the list: '))
if len(args) > 2:
listpasswd = args[2]
else:
- listpasswd = getpass.getpass(_('Initial %(listname)s password: '))
+ listpasswd = getpass.getpass(C_('Initial %(listname)s password: '))
# List passwords cannot be empty
listpasswd = listpasswd.strip()
if not listpasswd:
- usage(1, _('The list password cannot be empty'))
+ usage(1, C_('The list password cannot be empty'))
mlist = MailList.MailList()
try:
@@ -202,11 +214,13 @@ def main():
finally:
os.umask(oldmask)
except Errors.BadListNameError, s:
- usage(1, _('Illegal list name: %(s)s'))
+ usage(1, C_('Illegal list name: %(s)s'))
except Errors.EmailAddressError, s:
- usage(1, _('Bad owner email address: %(s)s'))
+ usage(1, C_('Bad owner email address: %(s)s') +
+ C_(' - owner addresses need to be fully-qualified names'
+ ' like "owner@example.com", not just "owner".'))
except Errors.MMListAlreadyExistsError:
- usage(1, _('List already exists: %(listname)s'))
+ usage(1, C_('List already exists: %(listname)s'))
# Assign domain-specific attributes
mlist.host_name = host_name
@@ -226,9 +240,10 @@ def main():
sys.modules[modname].create(mlist)
# And send the notice to the list owner
- if not quiet:
- print _('Hit enter to notify %(listname)s owner...'),
+ if not quiet and not automate:
+ print C_('Hit enter to notify %(listname)s owner...'),
sys.stdin.readline()
+ if not quiet:
siteowner = Utils.get_site_email(mlist.host_name, 'owner')
text = Utils.maketext(
'newlist.txt',