aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/add_members17
-rw-r--r--bin/arch10
-rw-r--r--bin/b4b5-archfix4
-rw-r--r--bin/change_pw13
-rwxr-xr-xbin/check_db12
-rwxr-xr-xbin/check_perms84
-rw-r--r--bin/cleanarch10
-rwxr-xr-xbin/clone_member26
-rw-r--r--bin/config_list29
-rw-r--r--bin/convert.py6
-rw-r--r--bin/discard12
-rw-r--r--bin/dumpdb16
-rw-r--r--bin/export.py18
-rwxr-xr-xbin/find_member14
-rw-r--r--bin/fix_url.py12
-rw-r--r--bin/genaliases6
-rw-r--r--bin/inject10
-rw-r--r--bin/list_admins8
-rw-r--r--bin/list_lists10
-rwxr-xr-xbin/list_members20
-rw-r--r--bin/list_owners4
-rw-r--r--bin/mailmanctl36
-rwxr-xr-xbin/mmsitepass20
-rwxr-xr-xbin/newlist27
-rw-r--r--bin/qrunner10
-rw-r--r--bin/rb-archfix4
-rwxr-xr-xbin/remove_members12
-rw-r--r--bin/reset_pw.py8
-rwxr-xr-xbin/rmlist30
-rw-r--r--bin/show_qfiles4
-rwxr-xr-xbin/sync_members36
-rwxr-xr-xbin/transcheck4
-rw-r--r--bin/unshunt6
-rwxr-xr-xbin/update94
-rw-r--r--bin/version4
-rw-r--r--bin/withlist26
36 files changed, 333 insertions, 329 deletions
diff --git a/bin/add_members b/bin/add_members
index a471919e..36ed3670 100755
--- a/bin/add_members
+++ b/bin/add_members
@@ -86,6 +86,7 @@ from Mailman import MailList
from Mailman import MemberAdaptor
_ = i18n._
+C_ = i18n.C_
@@ -94,7 +95,7 @@ def usage(status, msg=''):
fd = sys.stderr
else:
fd = sys.stdout
- print >> fd, _(__doc__)
+ print >> fd, C_(__doc__)
if msg:
print >> fd, msg
sys.exit(status)
@@ -121,7 +122,7 @@ class Tee:
self.__outfp = outfp
def write(self, msg):
- sys.stdout.write(msg)
+ sys.stdout.write(i18n.tolocale(msg))
self.__outfp.write(msg)
@@ -196,14 +197,14 @@ def main():
elif arg.lower()[0] == 'n':
send_welcome_msg = 0
else:
- usage(1, _('Bad argument to -w/--welcome-msg: %(arg)s'))
+ usage(1, C_('Bad argument to -w/--welcome-msg: %(arg)s'))
elif opt in ('-a', '--admin-notify'):
if arg.lower()[0] == 'y':
admin_notif = 1
elif arg.lower()[0] == 'n':
admin_notif = 0
else:
- usage(1, _('Bad argument to -a/--admin-notify: %(arg)s'))
+ usage(1, C_('Bad argument to -a/--admin-notify: %(arg)s'))
elif opt in ('-n', '--nomail'):
nomail = True
@@ -211,13 +212,13 @@ def main():
usage(1)
if dfile == "-" and nfile == "-":
- usage(1, _('Cannot read both digest and normal members '
- 'from standard input.'))
+ usage(1, C_('Cannot read both digest and normal members '
+ 'from standard input.'))
try:
mlist = MailList.MailList(listname)
except Errors.MMUnknownListError:
- usage(1, _('No such list: %(listname)s'))
+ usage(1, C_('No such list: %(listname)s'))
# Set up defaults
if send_welcome_msg is None:
@@ -237,7 +238,7 @@ def main():
nmembers = readfile(nfile)
if not dmembers and not nmembers:
- usage(0, _('Nothing to do.'))
+ usage(0, C_('Nothing to do.'))
s = StringIO()
i18n.set_language(mlist.preferred_language)
diff --git a/bin/arch b/bin/arch
index a98ae2af..8fdca6a3 100644
--- a/bin/arch
+++ b/bin/arch
@@ -70,7 +70,7 @@ from Mailman.Archiver.HyperArch import HyperArchive
from Mailman.LockFile import LockFile
from Mailman import i18n
-_ = i18n._
+C_ = i18n.C_
PROGRAM = sys.argv[0]
i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
@@ -82,7 +82,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)
@@ -122,7 +122,7 @@ def main():
# grok arguments
if len(args) < 1:
- usage(1, _('listname is required'))
+ usage(1, C_('listname is required'))
listname = args[0].lower().strip()
if len(args) < 2:
@@ -140,7 +140,7 @@ def main():
try:
mlist = MailList(listname)
except Errors.MMListError, e:
- usage(2, _('No such list "%(listname)s"\n%(e)s'))
+ usage(2, C_('No such list "%(listname)s"\n%(e)s'))
if mbox is None:
mbox = mlist.ArchiveFileName()
@@ -165,7 +165,7 @@ def main():
try:
fp = open(mbox)
except IOError, msg:
- usage(3, _('Cannot open mbox file %(mbox)s: %(msg)s'))
+ usage(3, C_('Cannot open mbox file %(mbox)s: %(msg)s'))
# Maybe wipe the old archives
if wipe:
if mlist.scrub_nondigest:
diff --git a/bin/b4b5-archfix b/bin/b4b5-archfix
index 1bdaedac..22d88394 100644
--- a/bin/b4b5-archfix
+++ b/bin/b4b5-archfix
@@ -44,7 +44,7 @@ import cPickle as pickle
# Required to get the right classes for unpickling
import paths
-from Mailman.i18n import _
+from Mailman.i18n import C_
PROGRAM = sys.argv[0]
@@ -55,7 +55,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)
diff --git a/bin/change_pw b/bin/change_pw
index 67d56392..f3bb1977 100644
--- a/bin/change_pw
+++ b/bin/change_pw
@@ -77,6 +77,7 @@ from Mailman import Message
from Mailman import i18n
_ = i18n._
+C_ = i18n.C_
SPACE = ' '
@@ -87,7 +88,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)
@@ -103,7 +104,7 @@ def openlist(listname):
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
- usage(1, _('No such list "%(listname)s"\n%(e)s'))
+ usage(1, C_('No such list "%(listname)s"\n%(e)s'))
_listcache[listname] = mlist
return mlist
@@ -141,11 +142,11 @@ def main():
if args:
strargs = SPACE.join(args)
- usage(1, _('Bad arguments: %(strargs)s'))
+ usage(1, C_('Bad arguments: %(strargs)s'))
if password is not None:
if not password:
- usage(1, _('Empty list passwords are not allowed'))
+ usage(1, C_('Empty list passwords are not allowed'))
shapassword = Utils.sha_new(password).hexdigest()
if domains:
@@ -155,7 +156,7 @@ def main():
listnames[name] = 1
if not listnames:
- print >> sys.stderr, _('Nothing to do.')
+ print >> sys.stderr, C_('Nothing to do.')
sys.exit(0)
# Set the password on the lists
@@ -177,7 +178,7 @@ def main():
mlist.Unlock()
# Notification
- print _('New %(listname)s password: %(notifypassword)s')
+ print C_('New %(listname)s password: %(notifypassword)s')
if not quiet:
otrans = i18n.get_translation()
i18n.set_language(mlist.preferred_language)
diff --git a/bin/check_db b/bin/check_db
index b1157bc7..40fa0a27 100755
--- a/bin/check_db
+++ b/bin/check_db
@@ -59,7 +59,7 @@ import paths
from Mailman import mm_cfg
from Mailman import Utils
from Mailman.MailList import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
PROGRAM = sys.argv[0]
@@ -70,7 +70,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)
@@ -111,12 +111,12 @@ def main():
listnames = [n.lower().strip() for n in listnames]
if not listnames:
- print _('Nothing to do.')
+ print C_('Nothing to do.')
sys.exit(0)
for listname in listnames:
if not Utils.list_exists(listname):
- print _('No list named:'), listname
+ print C_('No list named:'), listname
continue
mlist = MailList(listname, lock=0)
pfile = os.path.join(mlist.fullpath(), 'config.pck')
@@ -125,7 +125,7 @@ def main():
dlast = dfile + '.last'
if verbose:
- print _('List:'), listname
+ print C_('List:'), listname
for file in (pfile, plast, dfile, dlast):
status = 0
@@ -145,7 +145,7 @@ def main():
else:
print ' %s: %s' % (file, status)
elif verbose:
- print _(' %(file)s: okay')
+ print C_(' %(file)s: okay')
diff --git a/bin/check_perms b/bin/check_perms
index 137ebfb9..9d552ea7 100755
--- a/bin/check_perms
+++ b/bin/check_perms
@@ -45,7 +45,7 @@ directory. You must run this from the installation directory instead.
raise
from Mailman import mm_cfg
from Mailman.mm_cfg import MAILMAN_USER, MAILMAN_GROUP
-from Mailman.i18n import _
+from Mailman.i18n import C_
# Let KeyErrors percolate
MAILMAN_GID = grp.getgrnam(MAILMAN_GROUP)[2]
@@ -107,7 +107,7 @@ def checkwalk(arg, dirname, names):
for name in names:
path = os.path.join(dirname, name)
if arg.VERBOSE:
- print _(' checking gid and mode for %(path)s')
+ print C_(' checking gid and mode for %(path)s')
try:
mode, gid = statgidmode(path)
except OSError, e:
@@ -119,10 +119,10 @@ def checkwalk(arg, dirname, names):
except KeyError:
groupname = '<anon gid %d>' % gid
arg.ERRORS += 1
- print _('%(path)s bad group (has: %(groupname)s, '
- 'expected %(MAILMAN_GROUP)s)'),
+ print C_('%(path)s bad group (has: %(groupname)s, '
+ 'expected %(MAILMAN_GROUP)s)'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chown(path, -1, MAILMAN_GID)
else:
print
@@ -148,19 +148,19 @@ def checkwalk(arg, dirname, names):
octperms = oct(targetperms)
if S_ISDIR(mode) and (mode & targetperms) <> targetperms:
arg.ERRORS += 1
- print _('directory permissions must be %(octperms)s: %(path)s'),
+ print C_('directory permissions must be %(octperms)s: %(path)s'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | targetperms)
else:
print
elif os.path.splitext(path)[1] in ('.py', '.pyc', '.pyo'):
octperms = oct(PYFILEPERMS)
if mode & PYFILEPERMS <> PYFILEPERMS:
- print _('source perms must be %(octperms)s: %(path)s'),
+ print C_('source perms must be %(octperms)s: %(path)s'),
arg.ERRORS += 1
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | PYFILEPERMS)
else:
print
@@ -168,10 +168,10 @@ def checkwalk(arg, dirname, names):
# Article files must be group writeable
octperms = oct(ARTICLEFILEPERMS)
if mode & ARTICLEFILEPERMS <> ARTICLEFILEPERMS:
- print _('article db files must be %(octperms)s: %(path)s'),
+ print C_('article db files must be %(octperms)s: %(path)s'),
arg.ERRORS += 1
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | ARTICLEFILEPERMS)
else:
print
@@ -180,7 +180,7 @@ def checkall():
# first check PREFIX
if STATE.VERBOSE:
prefix = mm_cfg.PREFIX
- print _('checking mode for %(prefix)s')
+ print C_('checking mode for %(prefix)s')
dirs = {}
for d in (mm_cfg.PREFIX, mm_cfg.EXEC_PREFIX, mm_cfg.VAR_PREFIX,
mm_cfg.LOG_DIR):
@@ -190,13 +190,13 @@ def checkall():
mode = statmode(d)
except OSError, e:
if e.errno <> errno.ENOENT: raise
- print _('WARNING: directory does not exist: %(d)s')
+ print C_('WARNING: directory does not exist: %(d)s')
continue
if (mode & DIRPERMS) <> DIRPERMS:
STATE.ERRORS += 1
- print _('directory must be at least 02775: %(d)s'),
+ print C_('directory must be at least 02775: %(d)s'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(d, mode | DIRPERMS)
else:
print
@@ -206,21 +206,21 @@ def checkall():
def checkarchives():
private = mm_cfg.PRIVATE_ARCHIVE_FILE_DIR
if STATE.VERBOSE:
- print _('checking perms on %(private)s')
+ print C_('checking perms on %(private)s')
# private archives must not be other readable
mode = statmode(private)
if mode & S_IROTH:
STATE.ERRORS += 1
- print _('%(private)s must not be other-readable'),
+ print C_('%(private)s must not be other-readable'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(private, mode & ~S_IROTH)
else:
print
# In addition, on a multiuser system you may want to hide the private
# archives so other users can't read them.
if mode & S_IXOTH:
- print _("""\
+ print C_("""\
Warning: Private archive directory is other-executable (o+x).
This could allow other users on your system to read private archives.
If you're on a shared multiuser system, you should consult the
@@ -237,9 +237,9 @@ def checkmboxfile(mboxdir):
mode = statmode(mboxfile)
if (mode & MBOXPERMS) <> MBOXPERMS:
STATE.ERRORS = STATE.ERRORS + 1
- print _('mbox file must be at least 0660:'), mboxfile
+ print C_('mbox file must be at least 0660:'), mboxfile
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(mboxfile, mode | MBOXPERMS)
else:
print
@@ -260,9 +260,9 @@ def checkarchivedbs():
continue
if mode & S_IRWXO:
STATE.ERRORS += 1
- print _('%(dbdir)s "other" perms must be 000'),
+ print C_('%(dbdir)s "other" perms must be 000'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(dbdir, mode & ~S_IRWXO)
else:
print
@@ -270,18 +270,18 @@ def checkarchivedbs():
def checkcgi():
cgidir = os.path.join(mm_cfg.EXEC_PREFIX, 'cgi-bin')
if STATE.VERBOSE:
- print _('checking cgi-bin permissions')
+ print C_('checking cgi-bin permissions')
exes = os.listdir(cgidir)
for f in exes:
path = os.path.join(cgidir, f)
if STATE.VERBOSE:
- print _(' checking set-gid for %(path)s')
+ print C_(' checking set-gid for %(path)s')
mode = statmode(path)
if mode & S_IXGRP and not mode & S_ISGID:
STATE.ERRORS += 1
- print _('%(path)s must be set-gid'),
+ print C_('%(path)s must be set-gid'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | S_ISGID)
else:
print
@@ -289,13 +289,13 @@ def checkcgi():
def checkmail():
wrapper = os.path.join(mm_cfg.WRAPPER_DIR, 'mailman')
if STATE.VERBOSE:
- print _('checking set-gid for %(wrapper)s')
+ print C_('checking set-gid for %(wrapper)s')
mode = statmode(wrapper)
if not mode & S_ISGID:
STATE.ERRORS += 1
- print _('%(wrapper)s must be set-gid'),
+ print C_('%(wrapper)s must be set-gid'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(wrapper, mode | S_ISGID)
def checkadminpw():
@@ -303,7 +303,7 @@ def checkadminpw():
os.path.join(mm_cfg.DATA_DIR, 'creator.pw')):
targetmode = S_IFREG | S_IRUSR | S_IWUSR | S_IRGRP
if STATE.VERBOSE:
- print _('checking permissions on %(pwfile)s')
+ print C_('checking permissions on %(pwfile)s')
try:
mode = statmode(pwfile)
except OSError, e:
@@ -312,10 +312,10 @@ def checkadminpw():
if mode <> targetmode:
STATE.ERRORS += 1
octmode = oct(mode)
- print _('%(pwfile)s permissions must be exactly 0640 '
- '(got %(octmode)s)'),
+ print C_('%(pwfile)s permissions must be exactly 0640 '
+ '(got %(octmode)s)'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(pwfile, targetmode)
else:
print
@@ -337,7 +337,7 @@ def checkdata():
'digest.mbox', 'pending.pck',
'request.db', 'request.db.tmp')
if STATE.VERBOSE:
- print _('checking permissions on list data')
+ print C_('checking permissions on list data')
# BAW: This needs to be converted to the Site module abstraction
for dir in os.listdir(mm_cfg.LIST_DATA_DIR):
if not os.path.isdir(os.path.join(mm_cfg.LIST_DATA_DIR, dir)):
@@ -345,7 +345,7 @@ def checkdata():
for file in checkfiles:
path = os.path.join(mm_cfg.LIST_DATA_DIR, dir, file)
if STATE.VERBOSE:
- print _(' checking permissions on: %(path)s')
+ print C_(' checking permissions on: %(path)s')
try:
mode = statmode(path)
except OSError, e:
@@ -353,9 +353,9 @@ def checkdata():
continue
if (mode & targetmode) <> targetmode:
STATE.ERRORS += 1
- print _('file permissions must be at least 660: %(path)s'),
+ print C_('file permissions must be at least 660: %(path)s'),
if STATE.FIX:
- print _('(fixing)')
+ print C_('(fixing)')
os.chmod(path, mode | targetmode)
else:
print
@@ -367,7 +367,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)
@@ -398,7 +398,7 @@ if __name__ == '__main__':
checkmta()
if not STATE.ERRORS:
- print _('No problems found')
+ print C_('No problems found')
else:
- print _('Problems found:'), STATE.ERRORS
- print _('Re-run as %(MAILMAN_USER)s (or root) with -f flag to fix')
+ print C_('Problems found:'), STATE.ERRORS
+ print C_('Re-run as %(MAILMAN_USER)s (or root) with -f flag to fix')
diff --git a/bin/cleanarch b/bin/cleanarch
index a8485333..0994bca0 100644
--- a/bin/cleanarch
+++ b/bin/cleanarch
@@ -53,7 +53,7 @@ import getopt
import mailbox
import paths
-from Mailman.i18n import _
+from Mailman.i18n import C_
cre = re.compile(mailbox.UnixMailbox._fromlinepattern)
@@ -69,7 +69,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)
@@ -80,7 +80,7 @@ def escape_line(line, lineno, quiet, output):
if output:
sys.stdout.write('>' + line)
if not quiet:
- print >> sys.stderr, _('Unix-From line changed: %(lineno)d')
+ print >> sys.stderr, C_('Unix-From line changed: %(lineno)d')
print >> sys.stderr, line[:-1]
@@ -108,7 +108,7 @@ def main():
try:
status = int(arg)
except ValueError:
- usage(1, _('Bad status number: %(arg)s'))
+ usage(1, C_('Bad status number: %(arg)s'))
if args:
usage(1)
@@ -164,7 +164,7 @@ def main():
print >> sys.stderr
statuscnt = 0
prevline = line
- print >> sys.stderr, _('%(messages)d messages found')
+ print >> sys.stderr, C_('%(messages)d messages found')
diff --git a/bin/clone_member b/bin/clone_member
index 915c540f..b262aab5 100755
--- a/bin/clone_member
+++ b/bin/clone_member
@@ -72,7 +72,7 @@ import paths
from Mailman import MailList
from Mailman import Utils
from Mailman import Errors
-from Mailman.i18n import _
+from Mailman.i18n import C_
@@ -81,7 +81,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)
@@ -91,14 +91,14 @@ def usage(code, msg=''):
def dolist(mlist, options):
SPACE = ' '
if not options.quiet:
- print _('processing mailing list:'), mlist.internal_name()
+ print C_('processing mailing list:'), mlist.internal_name()
# scan the list owners. TBD: mlist.owner keys should be lowercase?
oldowners = mlist.owner[:]
oldowners.sort()
if options.admintoo:
if not options.quiet:
- print _(' scanning list owners:'), SPACE.join(oldowners)
+ print C_(' scanning list owners:'), SPACE.join(oldowners)
newowners = {}
foundp = 0
for owner in mlist.owner:
@@ -116,9 +116,9 @@ def dolist(mlist, options):
if not options.quiet:
if newowners <> oldowners:
print
- print _(' new list owners:'), SPACE.join(newowners)
+ print C_(' new list owners:'), SPACE.join(newowners)
else:
- print _('(no change)')
+ print C_('(no change)')
# see if the fromaddr is a digest member or regular member
if options.lfromaddr in mlist.getDigestMemberKeys():
@@ -127,13 +127,13 @@ def dolist(mlist, options):
digest = 0
else:
if not options.quiet:
- print _(' address not found:'), options.fromaddr
+ print C_(' address not found:'), options.fromaddr
return
# Check for banned to address.
pattern = mlist.GetBannedPattern(options.toaddr)
if pattern:
if not options.quiet:
- print ' ', _('Banned address (matched %(pattern)s)')
+ print ' ', C_('Banned address (matched %(pattern)s)')
return
# Now change the membership address
@@ -142,13 +142,13 @@ def dolist(mlist, options):
mlist.changeMemberAddress(options.fromaddr, options.toaddr,
not options.remove)
if not options.quiet:
- print _(' clone address added:'), options.toaddr
+ print C_(' clone address added:'), options.toaddr
except Errors.MMAlreadyAMember:
if not options.quiet:
- print _(' clone address is already a member:'), options.toaddr
+ print C_(' clone address is already a member:'), options.toaddr
if options.remove:
- print _(' original address removed:'), options.fromaddr
+ print C_(' original address removed:'), options.fromaddr
@@ -199,7 +199,7 @@ def main():
try:
Utils.ValidateEmail(toaddr)
except Errors.EmailAddressError:
- usage(1, _('Not a valid email address: %(toaddr)s'))
+ usage(1, C_('Not a valid email address: %(toaddr)s'))
lfromaddr = fromaddr.lower()
options.toaddr = toaddr
options.fromaddr = fromaddr
@@ -212,7 +212,7 @@ def main():
try:
mlist = MailList.MailList(listname)
except Errors.MMListError, e:
- print _('Error opening list "%(listname)s", skipping.\n%(e)s')
+ print C_('Error opening list "%(listname)s", skipping.\n%(e)s')
continue
try:
dolist(mlist, options)
diff --git a/bin/config_list b/bin/config_list
index 25d4fb62..e23dac24 100644
--- a/bin/config_list
+++ b/bin/config_list
@@ -76,6 +76,7 @@ from Mailman import Errors
from Mailman import i18n
_ = i18n._
+C_ = i18n.C_
NL = '\n'
nonasciipat = re.compile(r'[\x80-\xff]')
@@ -87,7 +88,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)
@@ -106,7 +107,7 @@ def do_output(listname, outfile):
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError:
- usage(1, _('No such list: %(listname)s'))
+ usage(1, C_('No such list: %(listname)s'))
# Preamble for the config info. PEP263 charset and capture time.
language = mlist.preferred_language
charset = Utils.GetCharSet(language)
@@ -114,7 +115,7 @@ def do_output(listname, outfile):
if not charset:
charset = 'us-ascii'
when = time.ctime(time.time())
- print >> outfp, _('''\
+ print >> outfp, C_('''\
# -*- python -*-
# -*- coding: %(charset)s -*-
## "%(listname)s" mailing list configuration settings
@@ -140,7 +141,7 @@ def do_list_categories(mlist, k, subcat, outfp):
if info is None:
return
charset = Utils.GetCharSet(mlist.preferred_language)
- print >> outfp, '##', k.capitalize(), _('options')
+ print >> outfp, '##', k.capitalize(), C_('options')
print >> outfp, '#'
# First, massage the descripton text, which could have obnoxious
# leading whitespace on second and subsequent lines due to
@@ -199,7 +200,7 @@ def do_list_categories(mlist, k, subcat, outfp):
outfp.write('"""\n')
elif vtype in (mm_cfg.Radio, mm_cfg.Toggle):
print >> outfp, '#'
- print >> outfp, '#', _('legal values are:')
+ print >> outfp, '#', C_('legal values are:')
# TBD: This is disgusting, but it's special cased
# everywhere else anyway...
if varname == 'subscribe_policy' and \
@@ -253,7 +254,7 @@ def do_input(listname, infile, checkonly, verbose):
try:
mlist = MailList.MailList(listname, lock=not checkonly)
except Errors.MMListError, e:
- usage(1, _('No such list "%(listname)s"\n%(e)s'))
+ usage(1, C_('No such list "%(listname)s"\n%(e)s'))
savelist = 0
guibyprop = getPropertyMap(mlist)
try:
@@ -266,16 +267,16 @@ def do_input(listname, infile, checkonly, verbose):
if k in ('mlist', '__builtins__'):
continue
if not hasattr(mlist, k):
- print >> sys.stderr, _('attribute "%(k)s" ignored')
+ print >> sys.stderr, C_('attribute "%(k)s" ignored')
continue
if verbose:
- print >> sys.stderr, _('attribute "%(k)s" changed')
+ print >> sys.stderr, C_('attribute "%(k)s" changed')
missing = []
gui, wtype = guibyprop.get(k, (missing, missing))
if gui is missing:
# This isn't an official property of the list, but that's
# okay, we'll just restore it the old fashioned way
- print >> sys.stderr, _('Non-standard property restored: %(k)s')
+ print >> sys.stderr, C_('Non-standard property restored: %(k)s')
setattr(mlist, k, v)
else:
# BAW: This uses non-public methods. This logic taken from
@@ -283,9 +284,9 @@ def do_input(listname, infile, checkonly, verbose):
try:
validval = gui._getValidValue(mlist, k, wtype, v)
except ValueError:
- print >> sys.stderr, _('Invalid value for property: %(k)s')
+ print >> sys.stderr, C_('Invalid value for property: %(k)s')
except Errors.EmailAddressError:
- print >> sys.stderr, _(
+ print >> sys.stderr, C_(
'Bad email address for option %(k)s: %(v)s')
else:
# BAW: Horrible hack, but then this is special cased
@@ -342,13 +343,13 @@ def main():
# sanity check
if infile is not None and outfile is not None:
- usage(1, _('Only one of -i or -o is allowed'))
+ usage(1, C_('Only one of -i or -o is allowed'))
if infile is None and outfile is None:
- usage(1, _('One of -i or -o is required'))
+ usage(1, C_('One of -i or -o is required'))
# get the list name
if len(args) <> 1:
- usage(1, _('List name is required'))
+ usage(1, C_('List name is required'))
listname = args[0].lower().strip()
if outfile:
diff --git a/bin/convert.py b/bin/convert.py
index b0d6a053..ad7228b1 100644
--- a/bin/convert.py
+++ b/bin/convert.py
@@ -25,7 +25,7 @@ This script is intended to be run as a bin/withlist script, i.e.
import paths
from Mailman import Utils
-from Mailman.i18n import _
+from Mailman.i18n import C_
def convert(mlist):
for attr in ('msg_header', 'msg_footer', 'digest_header', 'digest_footer',
@@ -35,10 +35,10 @@ def convert(mlist):
t = Utils.to_dollar(s)
setattr(mlist, attr, t)
mlist.use_dollar_strings = 1
- print _('Saving list')
+ print C_('Saving list')
mlist.Save()
if __name__ == '__main__':
- print _(__doc__.replace('%', '%%'))
+ print C_(__doc__.replace('%', '%%'))
diff --git a/bin/discard b/bin/discard
index c3019844..34cb811a 100644
--- a/bin/discard
+++ b/bin/discard
@@ -41,7 +41,7 @@ import getopt
import paths
from Mailman import mm_cfg
from Mailman.MailList import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
True, False
@@ -58,7 +58,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)
@@ -80,7 +80,7 @@ def main():
files = args
if not files:
- print _('Nothing to do.')
+ print C_('Nothing to do.')
# Mapping from listnames to sequence of request ids
discards = {}
@@ -91,13 +91,13 @@ def main():
basename = os.path.basename(f)
mo = cre.match(basename)
if not mo:
- print >> sys.stderr, _('Ignoring non-held message: %(f)s')
+ print >> sys.stderr, C_('Ignoring non-held message: %(f)s')
continue
listname, id = mo.group('listname', 'id')
try:
id = int(id)
except (ValueError, TypeError):
- print >> sys.stderr, _('Ignoring held msg w/bad id: %(f)s')
+ print >> sys.stderr, C_('Ignoring held msg w/bad id: %(f)s')
continue
discards.setdefault(listname, []).append(id)
@@ -109,7 +109,7 @@ def main():
# No comment, no preserve, no forward, no forwarding address
mlist.HandleRequest(id, mm_cfg.DISCARD, '', False, False, '')
if not quiet:
- print _('Discarded held msg #%(id)s for list %(listname)s')
+ print C_('Discarded held msg #%(id)s for list %(listname)s')
mlist.Save()
finally:
mlist.Unlock()
diff --git a/bin/dumpdb b/bin/dumpdb
index c8e42462..0b58fae9 100644
--- a/bin/dumpdb
+++ b/bin/dumpdb
@@ -54,7 +54,7 @@ from types import StringType
import paths
# Import this /after/ paths so that the sys.path is properly hacked
-from Mailman.i18n import _
+from Mailman.i18n import C_
PROGRAM = sys.argv[0]
COMMASPACE = ', '
@@ -72,7 +72,7 @@ def usage(code, msg=''):
fd = sys.stderr
else:
fd = sys.stdout
- print >> fd, _(__doc__) % globals()
+ print >> fd, C_(__doc__) % globals()
if msg:
print >> fd, msg
sys.exit(code)
@@ -102,10 +102,10 @@ def main():
doprint = False
if len(args) < 1:
- usage(1, _('No filename given.'))
+ usage(1, C_('No filename given.'))
elif len(args) > 1:
pargs = COMMASPACE.join(args)
- usage(1, _('Bad arguments: %(pargs)s'))
+ usage(1, C_('Bad arguments: %(pargs)s'))
else:
filename = args[0]
@@ -115,7 +115,7 @@ def main():
elif filename.endswith('.pck'):
filetype = 0
else:
- usage(1, _('Please specify either -p or -m.'))
+ usage(1, C_('Please specify either -p or -m.'))
# Handle dbs
pp = pprint.PrettyPrinter(indent=4)
@@ -130,16 +130,16 @@ def main():
try:
cnt = 1
if doprint:
- print _('[----- start %(typename)s file -----]')
+ print C_('[----- start %(typename)s file -----]')
while True:
try:
obj = load(fp)
except EOFError:
if doprint:
- print _('[----- end %(typename)s file -----]')
+ print C_('[----- end %(typename)s file -----]')
break
if doprint:
- print _('<----- start object %(cnt)s ----->')
+ print C_('<----- start object %(cnt)s ----->')
if isinstance(obj, StringType):
print obj
else:
diff --git a/bin/export.py b/bin/export.py
index 63247df4..83ab1de1 100644
--- a/bin/export.py
+++ b/bin/export.py
@@ -35,7 +35,7 @@ from Mailman import MemberAdaptor
from Mailman import Utils
from Mailman import mm_cfg
from Mailman.MailList import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
__i18n_templates__ = True
@@ -268,7 +268,7 @@ class XMLDumper(object):
try:
mlist = MailList(listname, lock=False)
except Errors.MMUnknownListError:
- print >> sys.stderr, _('No such list: %(listname)s')
+ print >> sys.stderr, C_('No such list: %(listname)s')
continue
self._dump_list(mlist, password_scheme)
self._pop_element('mailman')
@@ -316,39 +316,39 @@ else:
def parseargs():
parser = optparse.OptionParser(version=mm_cfg.VERSION,
- usage=_("""\
+ usage=C_("""\
%%prog [options]
Export the configuration and members of a mailing list in XML format."""))
parser.add_option('-o', '--outputfile',
metavar='FILENAME', default=None, type='string',
- help=_("""\
+ help=C_("""\
Output XML to FILENAME. If not given, or if FILENAME is '-', standard out is
used."""))
parser.add_option('-p', '--password-scheme',
- default='none', type='string', help=_("""\
+ default='none', type='string', help=C_("""\
Specify the RFC 2307 style hashing scheme for passwords included in the
output. Use -P to get a list of supported schemes, which are
case-insensitive."""))
parser.add_option('-P', '--list-hash-schemes',
- default=False, action='store_true', help=_("""\
+ default=False, action='store_true', help=C_("""\
List the supported password hashing schemes and exit. The scheme labels are
case-insensitive."""))
parser.add_option('-l', '--listname',
default=[], action='append', type='string',
- metavar='LISTNAME', dest='listnames', help=_("""\
+ metavar='LISTNAME', dest='listnames', help=C_("""\
The list to include in the output. If not given, then all mailing lists are
included in the XML output. Multiple -l flags may be given."""))
opts, args = parser.parse_args()
if args:
parser.print_help()
- parser.error(_('Unexpected arguments'))
+ parser.error(C_('Unexpected arguments'))
if opts.list_hash_schemes:
for label in SCHEMES:
print label.upper()
sys.exit(0)
if opts.password_scheme.lower() not in SCHEMES:
- parser.error(_('Invalid password scheme'))
+ parser.error(C_('Invalid password scheme'))
return parser, opts, args
diff --git a/bin/find_member b/bin/find_member
index a1701bf8..99e4ee60 100755
--- a/bin/find_member
+++ b/bin/find_member
@@ -64,7 +64,7 @@ import paths
from Mailman import Utils
from Mailman import MailList
from Mailman import Errors
-from Mailman.i18n import _
+from Mailman.i18n import C_
AS_MEMBER = 0x01
AS_OWNER = 0x02
@@ -76,7 +76,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)
@@ -94,7 +94,7 @@ def scanlists(options):
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError:
- print _('No such list: %(listname)s')
+ print C_('No such list: %(listname)s')
continue
if options.owners:
owners = mlist.owner
@@ -156,12 +156,12 @@ def main():
pass
if not args:
- usage(1, _('Search regular expression required'))
+ usage(1, C_('Search regular expression required'))
options.regexps = args
if not options.listnames:
- print _('No lists to search')
+ print C_('No lists to search')
return
matches = scanlists(options)
@@ -170,13 +170,13 @@ def main():
for k in addrs:
hits = matches[k]
lists = hits.keys()
- print k, _('found in:')
+ print k, C_('found in:')
for name in lists:
aswhat = hits[name]
if aswhat & AS_MEMBER:
print ' ', name
if aswhat & AS_OWNER:
- print ' ', name, _('(as owner)')
+ print ' ', name, C_('(as owner)')
diff --git a/bin/fix_url.py b/bin/fix_url.py
index d2731c14..d4840beb 100644
--- a/bin/fix_url.py
+++ b/bin/fix_url.py
@@ -43,12 +43,12 @@ import getopt
import paths
from Mailman import mm_cfg
-from Mailman.i18n import _
+from Mailman.i18n import C_
def usage(code, msg=''):
- print _(__doc__.replace('%', '%%'))
+ print C_(__doc__.replace('%', '%%'))
if msg:
print msg
sys.exit(code)
@@ -72,7 +72,7 @@ def fix_url(mlist, *args):
# Make sure list is locked.
if not mlist.Locked():
if verbose:
- print _('Locking list')
+ print C_('Locking list')
mlist.Lock()
if urlhost:
web_page_url = mm_cfg.DEFAULT_URL_PATTERN % urlhost
@@ -82,12 +82,12 @@ def fix_url(mlist, *args):
mailhost = mm_cfg.DEFAULT_EMAIL_HOST
if verbose:
- print _('Setting web_page_url to: %(web_page_url)s')
+ print C_('Setting web_page_url to: %(web_page_url)s')
mlist.web_page_url = web_page_url
if verbose:
- print _('Setting host_name to: %(mailhost)s')
+ print C_('Setting host_name to: %(mailhost)s')
mlist.host_name = mailhost
- print _('Saving list')
+ print C_('Saving list')
mlist.Save()
mlist.Unlock()
diff --git a/bin/genaliases b/bin/genaliases
index 77bc2907..f9ff707a 100644
--- a/bin/genaliases
+++ b/bin/genaliases
@@ -40,7 +40,7 @@ import paths # path hacking
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
True, False
@@ -55,7 +55,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)
@@ -81,7 +81,7 @@ def main():
if not mm_cfg.MTA:
mta = repr(mm_cfg.MTA)
- usage(2, _(
+ usage(2, C_(
"genaliases can't do anything useful with mm_cfg.MTA = %(mta)s."
))
diff --git a/bin/inject b/bin/inject
index 432c2922..fa91f5e3 100644
--- a/bin/inject
+++ b/bin/inject
@@ -48,7 +48,7 @@ import paths
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import Post
-from Mailman.i18n import _
+from Mailman.i18n import C_
@@ -57,7 +57,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)
@@ -81,14 +81,14 @@ def main():
elif opt in ('-q', '--queue'):
qdir = os.path.join(mm_cfg.QUEUE_DIR, arg)
if not os.path.isdir(qdir):
- usage(1, _('Bad queue directory: %(qdir)s'))
+ usage(1, C_('Bad queue directory: %(qdir)s'))
elif opt in ('-l', '--listname'):
listname = arg.lower()
if listname is None:
- usage(1, _('A list name is required'))
+ usage(1, C_('A list name is required'))
elif not Utils.list_exists(listname):
- usage(1, _('No such list: %(listname)s'))
+ usage(1, C_('No such list: %(listname)s'))
if len(args) == 0:
# Use standard input
diff --git a/bin/list_admins b/bin/list_admins
index b86a5eb8..f9304c7f 100644
--- a/bin/list_admins
+++ b/bin/list_admins
@@ -45,7 +45,7 @@ import getopt
import paths
from Mailman import MailList, Utils
from Mailman import Errors
-from Mailman.i18n import _
+from Mailman.i18n import C_
COMMASPACE = ', '
@@ -58,7 +58,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)
@@ -87,14 +87,14 @@ def main():
try:
mlist = MailList.MailList(listname, lock=0)
except Errors.MMListError, e:
- print _('No such list: %(listname)s')
+ print C_('No such list: %(listname)s')
continue
if vhost and vhost <> mlist.host_name:
continue
owners = COMMASPACE.join(mlist.owner)
- print _('List: %(listname)s, \tOwners: %(owners)s')
+ print C_('List: %(listname)s, \tOwners: %(owners)s')
diff --git a/bin/list_lists b/bin/list_lists
index f846e699..90923e2d 100644
--- a/bin/list_lists
+++ b/bin/list_lists
@@ -50,7 +50,7 @@ from Mailman import mm_cfg
from Mailman import MailList
from Mailman import Utils
from Mailman import Errors
-from Mailman.i18n import _
+from Mailman.i18n import C_
program = sys.argv[0]
@@ -59,7 +59,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)
@@ -110,18 +110,18 @@ def main():
longest = max(len(mlist.real_name), longest)
if not mlists and not bare:
- print _('No matching mailing lists found')
+ print C_('No matching mailing lists found')
return
if not bare:
- print len(mlists), _('matching mailing lists found:')
+ print len(mlists), C_('matching mailing lists found:')
format = '%%%ds - %%.%ds' % (longest, 77 - longest)
for mlist in mlists:
if bare:
print mlist.internal_name()
else:
- description = mlist.description or _('[no description available]')
+ description = mlist.description or C_('[no description available]')
print ' ', format % (mlist.real_name, description)
diff --git a/bin/list_members b/bin/list_members
index 8995acf2..72352e0b 100755
--- a/bin/list_members
+++ b/bin/list_members
@@ -81,7 +81,7 @@ from Mailman import Utils
from Mailman import MailList
from Mailman import Errors
from Mailman import MemberAdaptor
-from Mailman.i18n import _
+from Mailman.i18n import C_
from email.Utils import formataddr
@@ -109,7 +109,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)
@@ -195,7 +195,7 @@ def main():
if i >= 0:
why = opt[i+1:]
if why not in WHYCHOICES.keys():
- usage(1, _('Bad --nomail option: %(why)s'))
+ usage(1, C_('Bad --nomail option: %(why)s'))
elif opt == '-d':
digest = True
if args and args[0] in ('mime', 'plain'):
@@ -206,23 +206,23 @@ def main():
if i >= 0:
kind = opt[i+1:]
if kind not in ('mime', 'plain'):
- usage(1, _('Bad --digest option: %(kind)s'))
+ usage(1, C_('Bad --digest option: %(kind)s'))
elif opt in ('-m', '--moderated'):
moderatedonly = True
if nonmoderatedonly or invalidonly or unicodeonly:
- usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
+ usage(1, C_('Only one of -m, -M, -i or -u may be specified.'))
elif opt in ('-M', '--non-moderated'):
nonmoderatedonly = True
if moderatedonly or invalidonly or unicodeonly:
- usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
+ usage(1, C_('Only one of -m, -M, -i or -u may be specified.'))
elif opt in ('-i', '--invalid'):
invalidonly = True
if moderatedonly or nonmoderatedonly or unicodeonly:
- usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
+ usage(1, C_('Only one of -m, -M, -i or -u may be specified.'))
elif opt in ('-u', '--unicode'):
unicodeonly = True
if moderatedonly or nonmoderatedonly or invalidonly:
- usage(1, _('Only one of -m, -M, -i or -u may be specified.'))
+ usage(1, C_('Only one of -m, -M, -i or -u may be specified.'))
else:
# No more options left, push the last one back on the list
args.insert(0, opt)
@@ -240,7 +240,7 @@ def main():
try:
fp = open(outfile, 'w')
except IOError:
- print >> sys.stderr, _('Could not open file for writing:'), outfile
+ print >> sys.stderr, C_('Could not open file for writing:'), outfile
sys.exit(1)
else:
fp = sys.stdout
@@ -248,7 +248,7 @@ def main():
try:
mlist = MailList.MailList(listname, lock=False)
except Errors.MMListError, e:
- print >> sys.stderr, _('No such list: %(listname)s')
+ print >> sys.stderr, C_('No such list: %(listname)s')
sys.exit(1)
# Get the lowercased member addresses
diff --git a/bin/list_owners b/bin/list_owners
index 4c2d908d..adcba109 100644
--- a/bin/list_owners
+++ b/bin/list_owners
@@ -45,7 +45,7 @@ import getopt
import paths
from Mailman import Utils
from Mailman.MailList import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
PROGRAM = sys.argv[0]
@@ -62,7 +62,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)
diff --git a/bin/mailmanctl b/bin/mailmanctl
index 2c482221..8b767abb 100644
--- a/bin/mailmanctl
+++ b/bin/mailmanctl
@@ -108,7 +108,7 @@ from Mailman import Utils
from Mailman import LockFile
from Mailman import Errors
from Mailman.MailList import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
from Mailman.Logging.Syslog import syslog
from Mailman.Logging.Utils import LogStdErr
@@ -133,7 +133,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)
@@ -149,17 +149,17 @@ def kill_watcher(sig):
except (IOError, ValueError), e:
# For i18n convenience
pidfile = mm_cfg.PIDFILE
- print >> sys.stderr, _('PID unreadable in: %(pidfile)s')
+ print >> sys.stderr, C_('PID unreadable in: %(pidfile)s')
print >> sys.stderr, e
- print >> sys.stderr, _('Is qrunner even running?')
+ print >> sys.stderr, C_('Is qrunner even running?')
return
try:
os.kill(pid, sig)
except OSError, e:
if e.errno <> errno.ESRCH: raise
- print >> sys.stderr, _('No child with pid: %(pid)s')
+ print >> sys.stderr, C_('No child with pid: %(pid)s')
print >> sys.stderr, e
- print >> sys.stderr, _('Stale pid file removed.')
+ print >> sys.stderr, C_('Stale pid file removed.')
os.unlink(mm_cfg.PIDFILE)
@@ -218,19 +218,19 @@ def acquire_lock(force):
status = qrunner_state()
if status == 1:
# host matches and proc exists
- print >> sys.stderr, _("""\
+ print >> sys.stderr, C_("""\
The master qrunner lock could not be acquired because it appears as if another
master qrunner is already running.
""")
elif status == 0:
# host matches but no proc
- print >> sys.stderr, _("""\
+ print >> sys.stderr, C_("""\
The master qrunner lock could not be acquired. It appears as though there is
a stale master qrunner lock. Try re-running mailmanctl with the -s flag.
""")
else:
# host doesn't even match
- print >> sys.stderr, _("""\
+ print >> sys.stderr, C_("""\
The master qrunner lock could not be acquired, because it appears as if some
process on some other host may have acquired it. We can't test for stale
locks across host boundaries, so you'll have to do this manually. Or, if you
@@ -277,7 +277,7 @@ def check_for_site_list():
try:
sitelist = MailList(sitelistname, lock=0)
except Errors.MMUnknownListError:
- print >> sys.stderr, _('Site list is missing: %(sitelistname)s')
+ print >> sys.stderr, C_('Site list is missing: %(sitelistname)s')
syslog('error', 'Site list is missing: %s', mm_cfg.MAILMAN_SITE_LIST)
sys.exit(1)
@@ -302,7 +302,7 @@ def check_privs():
os.setuid(uid)
elif myuid <> uid:
name = mm_cfg.MAILMAN_USER
- usage(1, _(
+ usage(1, C_(
'Run this program as root or as the %(name)s user, or use -u.'))
@@ -333,15 +333,15 @@ def main():
quiet = 1
if len(args) < 1:
- usage(1, _('No command given.'))
+ usage(1, C_('No command given.'))
elif len(args) > 1:
command = COMMASPACE.join(args)
- usage(1, _('Bad command: %(command)s'))
+ usage(1, C_('Bad command: %(command)s'))
if checkprivs:
check_privs()
else:
- print _('Warning! You may encounter permission problems.')
+ print C_('Warning! You may encounter permission problems.')
# Handle the commands
command = args[0].lower()
@@ -350,18 +350,18 @@ def main():
# giving cron/qrunner a ctrl-c or KeyboardInterrupt. This will
# effectively shut everything down.
if not quiet:
- print _("Shutting down Mailman's master qrunner")
+ print C_("Shutting down Mailman's master qrunner")
kill_watcher(signal.SIGTERM)
elif command == 'restart':
# Sent the master qrunner process a SIGHUP. This will cause the
# master qrunner to kill and restart all the worker qrunners, and to
# close and re-open its log files.
if not quiet:
- print _("Restarting Mailman's master qrunner")
+ print C_("Restarting Mailman's master qrunner")
kill_watcher(signal.SIGINT)
elif command == 'reopen':
if not quiet:
- print _('Re-opening all log files')
+ print C_('Re-opening all log files')
kill_watcher(signal.SIGHUP)
elif command == 'start':
# First, complain loudly if there's no site list.
@@ -397,7 +397,7 @@ def main():
if pid:
# parent
if not quiet:
- print _("Starting Mailman's master qrunner.")
+ print C_("Starting Mailman's master qrunner.")
# Give up the lock "ownership". This just means the foreground
# process won't close/unlock the lock when it finalizes this lock
# instance. We'll let the mater watcher subproc own the lock.
diff --git a/bin/mmsitepass b/bin/mmsitepass
index 0bb6e77e..bb4cc712 100755
--- a/bin/mmsitepass
+++ b/bin/mmsitepass
@@ -43,7 +43,7 @@ import getopt
import paths
from Mailman import Utils
-from Mailman.i18n import _
+from Mailman.i18n import C_
PROGRAM = sys.argv[0]
@@ -54,7 +54,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)
@@ -70,34 +70,34 @@ def main():
# Defaults
siteadmin = 1
- pwdesc = _('site')
+ pwdesc = C_('site')
for opt, arg in opts:
if opt in ('-h', '--help'):
usage(0)
elif opt in ('-c', '--listcreator'):
siteadmin = 0
- pwdesc = _('list creator')
+ pwdesc = C_('list creator')
if len(args) == 1:
pw1 = args[0]
else:
try:
- pw1 = getpass.getpass(_('New %(pwdesc)s password: '))
- pw2 = getpass.getpass(_('Again to confirm password: '))
+ pw1 = getpass.getpass(C_('New %(pwdesc)s password: '))
+ pw2 = getpass.getpass(C_('Again to confirm password: '))
if pw1 <> pw2:
- print _('Passwords do not match; no changes made.')
+ print C_('Passwords do not match; no changes made.')
sys.exit(1)
except KeyboardInterrupt:
- print _('Interrupted...')
+ print C_('Interrupted...')
sys.exit(0)
# Set the site password by writing it to a local file. Make sure the
# permissions don't allow other+read.
Utils.set_global_password(pw1, siteadmin)
if Utils.check_global_password(pw1, siteadmin):
- print _('Password changed.')
+ print C_('Password changed.')
else:
- print _('Password change failed.')
+ print C_('Password change failed.')
diff --git a/bin/newlist b/bin/newlist
index f80595c8..202587fa 100755
--- a/bin/newlist
+++ b/bin/newlist
@@ -112,6 +112,7 @@ from Mailman import Message
from Mailman import i18n
_ = i18n._
+C_ = i18n.C_
PROGRAM = sys.argv[0]
@@ -122,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)
@@ -158,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:
@@ -178,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:
@@ -213,13 +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') +
- _(' - owner addresses need to be fully-qualified names'
- ' like "owner@example.com", not just "owner".'))
+ 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
@@ -240,7 +241,7 @@ def main():
# And send the notice to the list owner
if not quiet and not automate:
- print _('Hit enter to notify %(listname)s owner...'),
+ print C_('Hit enter to notify %(listname)s owner...'),
sys.stdin.readline()
if not quiet:
siteowner = Utils.get_site_email(mlist.host_name, 'owner')
diff --git a/bin/qrunner b/bin/qrunner
index 20fe830d..29bba0ff 100644
--- a/bin/qrunner
+++ b/bin/qrunner
@@ -78,7 +78,7 @@ import signal
import paths
from Mailman import mm_cfg
-from Mailman.i18n import _
+from Mailman.i18n import C_
from Mailman.Logging.Syslog import syslog
from Mailman.Logging.Utils import LogStdErr
@@ -95,7 +95,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)
@@ -175,8 +175,8 @@ def main():
name = runnername[:-len('Runner')]
else:
name = runnername
- print _('%(name)s runs the %(runnername)s qrunner')
- print _('All runs all the above qrunners')
+ print C_('%(name)s runs the %(runnername)s qrunner')
+ print C_('All runs all the above qrunners')
sys.exit(0)
elif opt in ('-o', '--once'):
once = 1
@@ -212,7 +212,7 @@ def main():
if len(args) <> 0:
usage(1)
if len(runners) == 0:
- usage(1, _('No runner name given.'))
+ usage(1, C_('No runner name given.'))
# Before we startup qrunners, we redirect the stderr to mailman syslog.
# We assume !AS_SUBPROC is running for debugging purpose and don't
diff --git a/bin/rb-archfix b/bin/rb-archfix
index fceadc27..2b1bef65 100644
--- a/bin/rb-archfix
+++ b/bin/rb-archfix
@@ -52,7 +52,7 @@ import cPickle as pickle
# Required to get the right classes for unpickling
import paths
-from Mailman.i18n import _
+from Mailman.i18n import C_
PROGRAM = sys.argv[0]
@@ -63,7 +63,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)
diff --git a/bin/remove_members b/bin/remove_members
index a7b4ebb4..33aa6a2b 100755
--- a/bin/remove_members
+++ b/bin/remove_members
@@ -66,7 +66,7 @@ import paths
from Mailman import MailList
from Mailman import Utils
from Mailman import Errors
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
True, False
@@ -81,7 +81,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)
@@ -153,14 +153,14 @@ def main():
try:
addresses = addresses + ReadFile(filename)
except IOError:
- print _('Could not open file for reading: %(filename)s.')
+ print C_('Could not open file for reading: %(filename)s.')
for listname in listnames:
try:
# open locked
mlist = MailList.MailList(listname)
except Errors.MMListError:
- print _('Error opening list %(listname)s... skipping.')
+ print C_('Error opening list %(listname)s... skipping.')
continue
if all:
@@ -170,12 +170,12 @@ def main():
for addr in addresses:
if not mlist.isMember(addr):
if not alllists:
- print _('No such member: %(addr)s')
+ print C_('No such member: %(addr)s')
continue
mlist.ApprovedDeleteMember(addr, 'bin/remove_members',
admin_notif, userack)
if alllists:
- print _("User `%(addr)s' removed from list: %(listname)s.")
+ print C_("User `%(addr)s' removed from list: %(listname)s.")
mlist.Save()
finally:
mlist.Unlock()
diff --git a/bin/reset_pw.py b/bin/reset_pw.py
index e829aefe..b71d5323 100644
--- a/bin/reset_pw.py
+++ b/bin/reset_pw.py
@@ -38,7 +38,7 @@ import getopt
import paths
from Mailman import Utils
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
@@ -54,7 +54,7 @@ def usage(code, msg=''):
fd = sys.stderr
else:
fd = sys.stdout
- print >> fd, _(__doc__.replace('%', '%%'))
+ print >> fd, C_(__doc__.replace('%', '%%'))
if msg:
print >> fd, msg
sys.exit(code)
@@ -74,13 +74,13 @@ def reset_pw(mlist, *args):
listname = mlist.internal_name()
if verbose:
- print _('Changing passwords for list: %(listname)s')
+ print C_('Changing passwords for list: %(listname)s')
for member in mlist.getMembers():
randompw = Utils.MakeRandomPassword()
mlist.setMemberPassword(member, randompw)
if verbose:
- print _('New password for member %(member)40s: %(randompw)s')
+ print C_('New password for member %(member)40s: %(randompw)s')
mlist.Save()
diff --git a/bin/rmlist b/bin/rmlist
index b0980104..9b2cc19f 100755
--- a/bin/rmlist
+++ b/bin/rmlist
@@ -46,7 +46,7 @@ import paths
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import MailList
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
True, False
@@ -61,7 +61,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)
@@ -70,15 +70,15 @@ def usage(code, msg=''):
def remove_it(listname, filename, msg):
if os.path.islink(filename):
- print _('Removing %(msg)s')
+ print C_('Removing %(msg)s')
os.unlink(filename)
elif os.path.isdir(filename):
- print _('Removing %(msg)s')
+ print C_('Removing %(msg)s')
shutil.rmtree(filename)
elif os.path.isfile(filename):
os.unlink(filename)
else:
- print _('%(listname)s %(msg)s not found as %(filename)s')
+ print C_('%(listname)s %(msg)s not found as %(filename)s')
@@ -102,13 +102,13 @@ def main():
if not Utils.list_exists(listname):
if not removeArchives:
- usage(1, _('No such list (or list already deleted): %(listname)s'))
+ usage(1, C_('No such list (or list already deleted): %(listname)s'))
else:
- print _(
+ print C_(
'No such list: %(listname)s. Removing its residual archives.')
if not removeArchives:
- print _('Not removing archives. Reinvoke with -a to remove them.')
+ print C_('Not removing archives. Reinvoke with -a to remove them.')
REMOVABLES = []
@@ -122,7 +122,7 @@ def main():
sys.modules[modname].remove(mlist)
REMOVABLES = [
- (os.path.join(mm_cfg.LIST_DATA_DIR, listname), _('list info')),
+ (os.path.join(mm_cfg.LIST_DATA_DIR, listname), C_('list info')),
]
# Remove any stale locks associated with the list
@@ -130,7 +130,7 @@ def main():
fn_listname = filename.split('.')[0]
if fn_listname == listname:
REMOVABLES.append((os.path.join(mm_cfg.LOCK_DIR, filename),
- _('stale lock file')))
+ C_('stale lock file')))
# Remove any held messages for this list
for filename in os.listdir(mm_cfg.DATA_DIR):
@@ -138,18 +138,18 @@ def main():
re.IGNORECASE)
if cre.match(filename):
REMOVABLES.append((os.path.join(mm_cfg.DATA_DIR, filename),
- _('held message file')))
+ C_('held message file')))
if removeArchives:
REMOVABLES.extend([
(os.path.join(mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, listname),
- _('private archives')),
+ C_('private archives')),
(os.path.join(mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, listname + '.mbox'),
- _('private archives')),
+ C_('private archives')),
(os.path.join(mm_cfg.PUBLIC_ARCHIVE_FILE_DIR, listname),
- _('public archives')),
+ C_('public archives')),
(os.path.join(mm_cfg.PUBLIC_ARCHIVE_FILE_DIR, listname + '.mbox'),
- _('public archives')),
+ C_('public archives')),
])
for dir, msg in REMOVABLES:
diff --git a/bin/show_qfiles b/bin/show_qfiles
index 0dbe9fe0..686a6529 100644
--- a/bin/show_qfiles
+++ b/bin/show_qfiles
@@ -37,7 +37,7 @@ import getopt
from cPickle import load
import paths
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
True, False
@@ -52,7 +52,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)
diff --git a/bin/sync_members b/bin/sync_members
index 0c860d25..bb5eaa73 100755
--- a/bin/sync_members
+++ b/bin/sync_members
@@ -86,7 +86,7 @@ from Mailman import MailList
from Mailman import Errors
from Mailman import Utils
from Mailman.UserDesc import UserDesc
-from Mailman.i18n import _
+from Mailman.i18n import C_
@@ -97,7 +97,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)
@@ -112,7 +112,7 @@ def yesno(opt):
elif yesno in ('n', 'no'):
return 0
else:
- usage(1, _('Bad choice: %(yesno)s'))
+ usage(1, C_('Bad choice: %(yesno)s'))
# no return
@@ -135,7 +135,7 @@ def main():
elif opt in ('-n', '--no-change'):
dryrun = 1
i += 1
- print _('Dry run mode')
+ print C_('Dry run mode')
elif opt in ('-d', '--digest'):
digest = 1
i += 1
@@ -156,11 +156,11 @@ def main():
i += 1
elif opt in ('-f', '--file'):
if filename is not None:
- usage(1, _('Only one -f switch allowed'))
+ usage(1, C_('Only one -f switch allowed'))
try:
filename = sys.argv[i+1]
except IndexError:
- usage(1, _('No argument to -f given'))
+ usage(1, C_('No argument to -f given'))
i += 2
elif opt in ('-a', '--notifyadmin'):
notifyadmin = 1
@@ -169,17 +169,17 @@ def main():
notifyadmin = yesno(opt)
i += 1
elif opt[0] == '-':
- usage(1, _('Illegal option: %(opt)s'))
+ usage(1, C_('Illegal option: %(opt)s'))
else:
try:
listname = sys.argv[i].lower()
i += 1
except IndexError:
- usage(1, _('No listname given'))
+ usage(1, C_('No listname given'))
break
if listname is None or filename is None:
- usage(1, _('Must have a listname and a filename'))
+ usage(1, C_('Must have a listname and a filename'))
# read the list of addresses to sync to from the file
if filename == '-':
@@ -188,7 +188,7 @@ def main():
try:
fp = open(filename)
except IOError, (code, msg):
- usage(1, _('Cannot read address file: %(filename)s: %(msg)s'))
+ usage(1, C_('Cannot read address file: %(filename)s: %(msg)s'))
try:
filemembers = fp.readlines()
finally:
@@ -200,7 +200,7 @@ def main():
addr = filemembers[i].strip()
if addr == '' or addr[:1] == '#':
del filemembers[i]
- print _('Ignore : %(addr)30s')
+ print C_('Ignore : %(addr)30s')
# first filter out any invalid addresses
filemembers = email.Utils.getaddresses(filemembers)
@@ -209,17 +209,17 @@ def main():
try:
Utils.ValidateEmail(addr)
except Errors.EmailAddressError:
- print _('Invalid : %(addr)30s')
+ print C_('Invalid : %(addr)30s')
invalid = 1
if invalid:
- print _('You must fix the preceding invalid addresses first.')
+ print C_('You must fix the preceding invalid addresses first.')
sys.exit(1)
# get the locked list object
try:
mlist = MailList.MailList(listname)
except Errors.MMListError, e:
- print _('No such list: %(listname)s')
+ print C_('No such list: %(listname)s')
sys.exit(1)
try:
@@ -241,7 +241,7 @@ def main():
needsadding[laddr] = (name, addr)
if not needsadding and not addrs:
- print _('Nothing to do.')
+ print C_('Nothing to do.')
sys.exit(0)
enc = sys.getdefaultencoding()
@@ -261,11 +261,11 @@ def main():
name = unicode(name, errors='replace')
name = name.encode(enc, 'replace')
s = email.Utils.formataddr((name, addr)).encode(enc, 'replace')
- print _('Added : %(s)s')
+ print C_('Added : %(s)s')
except Errors.MMAlreadyAMember:
pass
except Errors.MembershipIsBanned, pattern:
- print ('%s:' % addr), _('Banned address (matched %(pattern)s)')
+ print ('%s:' % addr), C_('Banned address (matched %(pattern)s)')
for laddr, addr in addrs.items():
# Should be a member, otherwise our test above is broken
@@ -285,7 +285,7 @@ def main():
name = unicode(name, errors='replace')
name = name.encode(enc, 'replace')
s = email.Utils.formataddr((name, addr)).encode(enc, 'replace')
- print _('Removed: %(s)s')
+ print C_('Removed: %(s)s')
mlist.Save()
finally:
diff --git a/bin/transcheck b/bin/transcheck
index 1fb3301b..e3753161 100755
--- a/bin/transcheck
+++ b/bin/transcheck
@@ -36,7 +36,7 @@ import os
import getopt
import paths
-from Mailman.i18n import _
+from Mailman.i18n import C_
program = sys.argv[0]
@@ -47,7 +47,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)
diff --git a/bin/unshunt b/bin/unshunt
index 842cc0fb..e17ecae7 100644
--- a/bin/unshunt
+++ b/bin/unshunt
@@ -38,7 +38,7 @@ import getopt
import paths
from Mailman import mm_cfg
from Mailman.Queue.sbcache import get_switchboard
-from Mailman.i18n import _
+from Mailman.i18n import C_
@@ -47,7 +47,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)
@@ -82,7 +82,7 @@ def main():
except Exception, e:
# If there are any unshunting errors, log them and continue trying
# other shunted messages.
- print >> sys.stderr, _(
+ print >> sys.stderr, C_(
'Cannot unshunt message %(filebase)s, skipping:\n%(e)s')
else:
# Unlink the .bak file left by dequeue()
diff --git a/bin/update b/bin/update
index d74cae92..b5843424 100755
--- a/bin/update
+++ b/bin/update
@@ -52,7 +52,7 @@ from Mailman import MailList
from Mailman import Message
from Mailman import Pending
from Mailman.LockFile import TimeOutError
-from Mailman.i18n import _
+from Mailman.i18n import C_
from Mailman.Queue.Switchboard import Switchboard
from Mailman.OldStyleMemberships import OldStyleMemberships
from Mailman.MemberAdaptor import BYBOUNCE, ENABLED
@@ -104,7 +104,7 @@ def make_varabs(relpath):
def move_language_templates(mlist):
listname = mlist.internal_name()
- print _('Fixing language templates: %(listname)s')
+ print C_('Fixing language templates: %(listname)s')
# Mailman 2.1 has a new cascading search for its templates, defined and
# described in Utils.py:maketext(). Putting templates in the top level
# templates/ subdir or the lists/<listname> subdir is deprecated and no
@@ -193,8 +193,8 @@ def dolist(listname):
try:
mlist.Lock(0.5)
except TimeOutError:
- print >> sys.stderr, _('WARNING: could not acquire lock for list: '
- '%(listname)s')
+ print >> sys.stderr, C_('WARNING: could not acquire lock for list: '
+ '%(listname)s')
return 1
# Sanity check the invariant that every BYBOUNCE disabled member must have
@@ -212,13 +212,13 @@ def dolist(listname):
# re-disable them if necessary.
n = len(noinfo)
if n > 0:
- print _(
+ print C_(
'Resetting %(n)s BYBOUNCEs disabled addrs with no bounce info')
for addr in noinfo.keys():
mlist.setDeliveryStatus(addr, ENABLED)
# Update the held requests database
- print _("""Updating the held requests database.""")
+ print C_("""Updating the held requests database.""")
mlist._UpdateRecords()
mbox_dir = make_varabs('archives/private/%s.mbox' % (listname))
@@ -240,7 +240,7 @@ def dolist(listname):
else:
# this shouldn't happen, but hey, just in case
if not os.path.isdir(mbox_dir):
- print _("""\
+ print C_("""\
For some reason, %(mbox_dir)s exists as a file. This won't work with
b6, so I'm renaming it to %(mbox_dir)s.tmp and proceeding.""")
os.rename(mbox_dir, "%s.tmp" % (mbox_dir))
@@ -252,7 +252,7 @@ b6, so I'm renaming it to %(mbox_dir)s.tmp and proceeding.""")
# private one existing
if os.path.isfile(o_pri_mbox_file) and os.path.isfile(o_pub_mbox_file):
if mlist.archive_private:
- print _("""\
+ print C_("""\
%(listname)s has both public and private mbox archives. Since this list
currently uses private archiving, I'm installing the private mbox archive
@@ -267,7 +267,7 @@ script.
o_pub_mbox_file)
os.rename(o_pub_mbox_file, "%s.preb6" % (o_pub_mbox_file))
else:
- print _("""\
+ print C_("""\
%s has both public and private mbox archives. Since this list
currently uses public archiving, I'm installing the public mbox file
archive file (%s) as the active one, and renaming
@@ -284,7 +284,7 @@ script.
# move private archive mbox there if it's around
# and take into account all sorts of absurdities
#
- print _('- updating old private mbox file')
+ print C_('- updating old private mbox file')
if os.path.exists(o_pri_mbox_file):
if os.path.isfile(o_pri_mbox_file):
os.rename(o_pri_mbox_file, mbox_file)
@@ -292,21 +292,21 @@ script.
newname = "%s.mm_install-dunno_what_this_was_but_its_in_the_way" \
% o_pri_mbox_file
os.rename(o_pri_mbox_file, newname)
- print _("""\
+ print C_("""\
unknown file in the way, moving
%(o_pri_mbox_file)s
to
%(newname)s""")
else:
# directory
- print _('Nothing to do.')
+ print C_('Nothing to do.')
#
# move public archive mbox there if it's around
# and take into account all sorts of absurdities.
#
- print _('- updating old public mbox file')
+ print C_('- updating old public mbox file')
if os.path.exists(o_pub_mbox_file):
if os.path.isfile(o_pub_mbox_file):
os.rename(o_pub_mbox_file, mbox_file)
@@ -314,13 +314,13 @@ script.
newname = "%s.mm_install-dunno_what_this_was_but_its_in_the_way" \
% o_pub_mbox_file
os.rename(o_pub_mbox_file, newname)
- print _("""\
+ print C_("""\
unknown file in the way, moving
%(o_pub_mbox_file)s
to
%(newname)s""")
else: # directory
- print _('Nothing to do.')
+ print C_('Nothing to do.')
#
# move the html archives there
@@ -350,7 +350,7 @@ script.
b4_tmpl_dir = os.path.join(tmpl_dir, mlist._internal_name)
new_tmpl_dir = os.path.join(list_dir, mlist._internal_name)
if os.path.exists(b4_tmpl_dir):
- print _("""\
+ print C_("""\
- This list looks like it might have <= b4 list templates around""")
for f in os.listdir(b4_tmpl_dir):
o_tmpl = os.path.join(b4_tmpl_dir, f)
@@ -358,12 +358,12 @@ script.
if os.path.exists(o_tmpl):
if not os.path.exists(n_tmpl):
os.rename(o_tmpl, n_tmpl)
- print _('- moved %(o_tmpl)s to %(n_tmpl)s')
+ print C_('- moved %(o_tmpl)s to %(n_tmpl)s')
else:
- print _("""\
+ print C_("""\
- both %(o_tmpl)s and %(n_tmpl)s exist, leaving untouched""")
else:
- print _("""\
+ print C_("""\
- %(o_tmpl)s doesn't exist, leaving untouched""")
#
# Move all the templates to the en language subdirectory as required for
@@ -393,23 +393,23 @@ def remove_old_sources(module):
src = '%s/%s' % (mm_cfg.PREFIX, module)
pyc = src + "c"
if os.path.isdir(src):
- print _('removing directory %(src)s and everything underneath')
+ print C_('removing directory %(src)s and everything underneath')
shutil.rmtree(src)
elif os.path.exists(src):
- print _('removing %(src)s')
+ print C_('removing %(src)s')
try:
os.unlink(src)
except os.error, rest:
- print _("Warning: couldn't remove %(src)s -- %(rest)s")
+ print C_("Warning: couldn't remove %(src)s -- %(rest)s")
if module.endswith('.py') and os.path.exists(pyc):
try:
os.unlink(pyc)
except os.error, rest:
- print _("couldn't remove old file %(pyc)s -- %(rest)s")
+ print C_("couldn't remove old file %(pyc)s -- %(rest)s")
def update_qfiles():
- print _('updating old qfiles')
+ print C_('updating old qfiles')
prefix = `time.time()` + '+'
# Be sure the qfiles/in directory exists (we don't really need the
# switchboard object, but it's convenient for creating the directory).
@@ -452,7 +452,7 @@ def update_qfiles():
except EnvironmentError, e:
if e.errno <> errno.ENOTDIR:
raise
- print _('Warning! Not a directory: %(dirpath)s')
+ print C_('Warning! Not a directory: %(dirpath)s')
@@ -527,7 +527,7 @@ def dequeue(filebase):
# This message was unparsable, most likely because its
# MIME encapsulation was broken. For now, there's not
# much we can do about it.
- print _('message is unparsable: %(filebase)s')
+ print C_('message is unparsable: %(filebase)s')
msgfp.close()
msgfp = None
if mm_cfg.QRUNNER_SAVE_BAD_MESSAGES:
@@ -541,7 +541,7 @@ def dequeue(filebase):
msg = data = None
except EOFError:
# For some reason the pckfile was empty. Just delete it.
- print _('Warning! Deleting empty .pck file: %(pckfile)s')
+ print C_('Warning! Deleting empty .pck file: %(pckfile)s')
os.unlink(pckfile)
finally:
if msgfp:
@@ -560,7 +560,7 @@ def update_pending():
except IOError, e:
if e.errno <> errno.ENOENT: raise
else:
- print _('Updating Mailman 2.0 pending_subscriptions.db database')
+ print C_('Updating Mailman 2.0 pending_subscriptions.db database')
db = marshal.load(fp)
# Convert to the pre-Mailman 2.1.5 format
db = Pending._update(db)
@@ -571,10 +571,10 @@ def update_pending():
except IOError, e:
if e.errno <> errno.ENOENT: raise
else:
- print _('Updating Mailman 2.1.4 pending.pck database')
+ print C_('Updating Mailman 2.1.4 pending.pck database')
db = cPickle.load(fp)
if db is None:
- print _('Nothing to do.')
+ print C_('Nothing to do.')
return
# Now upgrade the database to the 2.1.5 format. Each list now has its own
# pending.pck file, but only the RE_ENABLE operation actually recorded the
@@ -595,7 +595,7 @@ def update_pending():
op = val[0]
data = val[1:]
except (IndexError, ValueError):
- print _('Ignoring bad pended data: %(key)s: %(val)s')
+ print C_('Ignoring bad pended data: %(key)s: %(val)s')
continue
if op in (Pending.UNSUBSCRIPTION, Pending.CHANGE_OF_ADDRESS):
# data[0] is the address being unsubscribed
@@ -611,7 +611,7 @@ def update_pending():
# data[0] is the hold id. There better only be one entry per id
id = data[0]
if holds_by_id.has_key(id):
- print _('WARNING: Ignoring duplicate pending ID: %(id)s.')
+ print C_('WARNING: Ignoring duplicate pending ID: %(id)s.')
else:
holds_by_id[id] = (key, val)
# Now we have to lock every list and re-pend all the appropriate
@@ -664,7 +664,7 @@ def update_pending():
def main():
errors = 0
# get rid of old stuff
- print _('getting rid of old source files')
+ print C_('getting rid of old source files')
for mod in ('Mailman/Archiver.py', 'Mailman/HyperArch.py',
'Mailman/HyperDatabase.py', 'Mailman/pipermail.py',
'Mailman/smtplib.py', 'Mailman/Cookie.py',
@@ -674,29 +674,29 @@ def main():
remove_old_sources(mod)
listnames = Utils.list_names()
if not listnames:
- print _('no lists == nothing to do, exiting')
+ print C_('no lists == nothing to do, exiting')
return
#
# for people with web archiving, make sure the directories
# in the archiving are set with proper perms for b6.
#
if os.path.isdir("%s/public_html/archives" % mm_cfg.PREFIX):
- print _("""\
+ print C_("""\
fixing all the perms on your old html archives to work with b6
If your archives are big, this could take a minute or two...""")
os.path.walk("%s/public_html/archives" % mm_cfg.PREFIX,
archive_path_fixer, "")
- print _('done')
+ print C_('done')
for listname in listnames:
- print _('Updating mailing list: %(listname)s')
+ print C_('Updating mailing list: %(listname)s')
errors = errors + dolist(listname)
print
- print _('Updating Usenet watermarks')
+ print C_('Updating Usenet watermarks')
wmfile = os.path.join(mm_cfg.DATA_DIR, 'gate_watermarks')
try:
fp = open(wmfile)
except IOError:
- print _('- nothing to update here')
+ print C_('- nothing to update here')
else:
d = marshal.load(fp)
fp.close()
@@ -708,7 +708,7 @@ If your archives are big, this could take a minute or two...""")
try:
mlist.Lock(0.5)
except TimeOutError:
- print >> sys.stderr, _(
+ print >> sys.stderr, C_(
'WARNING: could not acquire lock for list: %(listname)s')
errors = errors + 1
else:
@@ -719,7 +719,7 @@ If your archives are big, this could take a minute or two...""")
mlist.Save()
mlist.Unlock()
os.unlink(wmfile)
- print _('- usenet watermarks updated and gate_watermarks removed')
+ print C_('- usenet watermarks updated and gate_watermarks removed')
# In Mailman 2.1, the pending database format and file name changed, but
# in Mailman 2.1.5 it changed again. This should update all existing
# files to the 2.1.5 format.
@@ -733,7 +733,7 @@ If your archives are big, this could take a minute or two...""")
# There's no good way of figuring this out for releases prior to 2.0beta2
# :(
if lastversion == NOTFRESH:
- print _("""
+ print C_("""
NOTE NOTE NOTE NOTE NOTE
@@ -760,7 +760,7 @@ def usage(code, msg=''):
fd = sys.stderr
else:
fd = sys.stdout
- print >> fd, _(__doc__) % globals()
+ print >> fd, C_(__doc__) % globals()
if msg:
print >> sys.stderr, msg
sys.exit(code)
@@ -790,15 +790,15 @@ if __name__ == '__main__':
hextversion = hex(thisversion)
if lastversion == thisversion and not force:
# nothing to do
- print _('No updates are necessary.')
+ print C_('No updates are necessary.')
sys.exit(0)
if lastversion > thisversion and not force:
- print _("""\
+ print C_("""\
Downgrade detected, from version %(hexlversion)s to version %(hextversion)s
This is probably not safe.
Exiting.""")
sys.exit(1)
- print _('Upgrading from version %(hexlversion)s to %(hextversion)s')
+ print C_('Upgrading from version %(hexlversion)s to %(hextversion)s')
errors = main()
if not errors:
# Record the version we just upgraded to
@@ -807,7 +807,7 @@ Exiting.""")
fp.close()
else:
lockdir = mm_cfg.LOCK_DIR
- print _('''\
+ print C_('''\
ERROR:
diff --git a/bin/version b/bin/version
index 72c50b89..4efba6f0 100644
--- a/bin/version
+++ b/bin/version
@@ -21,6 +21,6 @@
import paths
import Mailman.mm_cfg
-from Mailman.i18n import _
+from Mailman.i18n import C_
-print _('Using Mailman version:'), Mailman.mm_cfg.VERSION
+print C_('Using Mailman version:'), Mailman.mm_cfg.VERSION
diff --git a/bin/withlist b/bin/withlist
index 38ab9abb..48f19cc6 100644
--- a/bin/withlist
+++ b/bin/withlist
@@ -128,7 +128,7 @@ import paths
from Mailman import Errors
from Mailman import MailList
from Mailman import Utils
-from Mailman.i18n import _
+from Mailman.i18n import C_
try:
True, False
@@ -154,7 +154,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)
@@ -172,11 +172,11 @@ def atexit():
if m.Locked():
if VERBOSE:
listname = m.internal_name()
- print >> sys.stderr, _(
+ print >> sys.stderr, C_(
'Unlocking (but not saving) list: %(listname)s')
m.Unlock()
if VERBOSE:
- print >> sys.stderr, _('Finalizing')
+ print >> sys.stderr, C_('Finalizing')
del m
@@ -185,16 +185,16 @@ def do_list(listname, args, func):
global m
# first try to open mailing list
if VERBOSE:
- print >> sys.stderr, _('Loading list %(listname)s'),
+ print >> sys.stderr, C_('Loading list %(listname)s'),
if LOCK:
- print >> sys.stderr, _('(locked)')
+ print >> sys.stderr, C_('(locked)')
else:
- print >> sys.stderr, _('(unlocked)')
+ print >> sys.stderr, C_('(unlocked)')
try:
m = MailList.MailList(listname, lock=LOCK)
except Errors.MMUnknownListError:
- print >> sys.stderr, _('Unknown list: %(listname)s')
+ print >> sys.stderr, C_('Unknown list: %(listname)s')
m = None
# try to import the module and run the callable
@@ -234,7 +234,7 @@ def main():
all = True
if len(args) < 1 and not all:
- warning = _('No list name supplied.')
+ warning = C_('No list name supplied.')
if interact:
# Let them keep going
print warning
@@ -243,7 +243,7 @@ def main():
usage(1, warning)
if all and not run:
- usage(1, _('--all requires --run'))
+ usage(1, C_('--all requires --run'))
# The default for interact is 1 unless -r was given
if interact is None:
@@ -263,11 +263,11 @@ def main():
module = run[:i]
callable = run[i+1:]
if VERBOSE:
- print >> sys.stderr, _('Importing %(module)s...')
+ print >> sys.stderr, C_('Importing %(module)s...')
__import__(module)
mod = sys.modules[module]
if VERBOSE:
- print >> sys.stderr, _('Running %(module)s.%(callable)s()...')
+ print >> sys.stderr, C_('Running %(module)s.%(callable)s()...')
func = getattr(mod, callable)
if all:
@@ -288,7 +288,7 @@ def main():
namespace = globals().copy()
namespace.update(locals())
if dolist:
- ban = _("The variable `m' is the %(listname)s MailList instance")
+ ban = C_("The variable `m' is the %(listname)s MailList instance")
else:
ban = None
code.InteractiveConsole(namespace).interact(ban)