aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Mailman/Bouncer.py7
-rw-r--r--Mailman/Cgi/admin.py17
-rw-r--r--Mailman/Cgi/options.py6
-rwxr-xr-xMailman/ListAdmin.py7
-rwxr-xr-xMailman/MailList.py32
5 files changed, 53 insertions, 16 deletions
diff --git a/Mailman/Bouncer.py b/Mailman/Bouncer.py
index 2a1cb539..ae0c012c 100644
--- a/Mailman/Bouncer.py
+++ b/Mailman/Bouncer.py
@@ -40,7 +40,8 @@ EMPTYSTRING = ''
# for time.mktime().
ZEROHOUR_PLUSONEDAY = time.localtime(mm_cfg.days(1))[:3]
-def _(s): return s
+def D_(s): return s
+_ = D_
REASONS = {MemberAdaptor.BYBOUNCE: _('due to excessive bounces'),
MemberAdaptor.BYUSER: _('by yourself'),
@@ -264,10 +265,12 @@ class Bouncer:
reason = self.getDeliveryStatus(member)
if info.noticesleft <= 0:
# BAW: Remove them now, with a notification message
+ _ = D_
self.ApprovedDeleteMember(
- member, 'disabled address',
+ member, _('disabled address'),
admin_notif=self.bounce_notify_owner_on_removal,
userack=1)
+ _ = i18n._
# Expunge the pending cookie for the user. We throw away the
# returned data.
self.pend_confirm(info.cookie)
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py
index 174cf34f..f44e01db 100644
--- a/Mailman/Cgi/admin.py
+++ b/Mailman/Cgi/admin.py
@@ -47,6 +47,8 @@ from Mailman.CSRFcheck import csrf_check
# Set up i18n
_ = i18n._
i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+def D_(s):
+ return s
NL = '\n'
OPTCOLUMNS = 11
@@ -1482,9 +1484,12 @@ def change_options(mlist, category, subcat, cgidata, doc):
else:
mlist.InviteNewMember(userdesc, invitation)
else:
+ _ = D_
+ whence = _('admin mass sub')
+ _ = i18n._
mlist.ApprovedAddMember(userdesc, send_welcome_msg,
send_admin_notif, invitation,
- whence='admin mass sub')
+ whence=whence)
except Errors.MMAlreadyAMember:
subscribe_errors.append((safeentry, _('Already a member')))
except Errors.MMBadEmailError:
@@ -1537,8 +1542,11 @@ def change_options(mlist, category, subcat, cgidata, doc):
unsubscribe_success = []
for addr in names:
try:
+ _ = D_
+ whence = _('admin mass unsub')
+ _ = i18n._
mlist.ApprovedDeleteMember(
- addr, whence='admin mass unsub',
+ addr, whence=whence,
admin_notif=send_unsub_notifications,
userack=userack)
unsubscribe_success.append(Utils.websafe(addr))
@@ -1645,7 +1653,10 @@ def change_options(mlist, category, subcat, cgidata, doc):
quser = urllib.quote(user)
if cgidata.has_key('%s_unsub' % quser):
try:
- mlist.ApprovedDeleteMember(user, whence='member mgt page')
+ _ = D_
+ whence=_('member mgt page')
+ _ = i18n._
+ mlist.ApprovedDeleteMember(user, whence=whence)
removes.append(user)
except Errors.NotAMemberError:
errors.append((user, _('Not subscribed')))
diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py
index 4f128baf..c2a84ecb 100644
--- a/Mailman/Cgi/options.py
+++ b/Mailman/Cgi/options.py
@@ -45,6 +45,8 @@ DIGRE = re.compile(
# Set up i18n
_ = i18n._
i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE)
+def D_(s):
+ return s
try:
True, False
@@ -581,9 +583,10 @@ address. Upon confirmation, any other mailing list containing the address
mlist.Lock()
needapproval = False
try:
+ _ = D_
try:
mlist.DeleteMember(
- user, 'via the member options page', userack=1)
+ user, _('via the member options page'), userack=1)
except Errors.MMNeedApproval:
needapproval = True
except Errors.NotAMemberError:
@@ -595,6 +598,7 @@ address. Upon confirmation, any other mailing list containing the address
pass
mlist.Save()
finally:
+ _ = i18n._
mlist.Unlock()
# Now throw up some results page, with appropriate links. We can't
# drop them back into their options page, because that's gone now!
diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py
index 877aa5c4..8825760a 100755
--- a/Mailman/ListAdmin.py
+++ b/Mailman/ListAdmin.py
@@ -45,6 +45,8 @@ from Mailman.Logging.Syslog import syslog
from Mailman import i18n
_ = i18n._
+def D_(s):
+ return s
# Request types requiring admin approval
IGN = 0
@@ -435,8 +437,11 @@ class ListAdmin:
# subscribe
assert value == mm_cfg.SUBSCRIBE
try:
+ _ = D_
+ whence = _('via admin approval')
+ _ = i18n._
userdesc = UserDesc(addr, fullname, password, digest, lang)
- self.ApprovedAddMember(userdesc, whence='via admin approval')
+ self.ApprovedAddMember(userdesc, whence=whence)
except Errors.MMAlreadyAMember:
# User has already been subscribed, after sending the request
pass
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index cc1be3b5..d2a15e29 100755
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -72,6 +72,8 @@ from Mailman import i18n
from Mailman.Logging.Syslog import syslog
_ = i18n._
+def D_(s):
+ return s
EMPTYSTRING = ''
OR = '|'
@@ -1058,13 +1060,20 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
syslog('subscribe', '%s: new%s %s, %s', self.internal_name(),
kind, formataddr((name, email)), whence)
if ack:
- self.SendSubscribeAck(email, self.getMemberPassword(email),
- digest, text)
+ lang = self.preferred_language
+ otrans = i18n.get_translation()
+ i18n.set_language(lang)
+ try:
+ self.SendSubscribeAck(email, self.getMemberPassword(email),
+ digest, text)
+ finally:
+ i18n.set_translation(otrans)
if admin_notif:
lang = self.preferred_language
otrans = i18n.get_translation()
i18n.set_language(lang)
try:
+ whence = "" if whence is None else "(" + _(whence) + ")"
realname = self.real_name
subject = _('%(realname)s subscription notification')
finally:
@@ -1075,7 +1084,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
"adminsubscribeack.txt",
{"listname" : realname,
"member" : formataddr((name, email)),
- "whence" : "" if whence is None else "(" + whence + ")"
+ "whence" : whence
}, mlist=self)
msg = Message.OwnerNotification(self, subject, text)
msg.send(self)
@@ -1112,7 +1121,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
'adminunsubscribeack.txt',
{'member' : name,
'listname': self.real_name,
- "whence" : "" if whence is None else "(" + whence + ")"
+ "whence" : "" if whence is None else "(" + _(whence) + ")"
}, mlist=self)
msg = Message.OwnerNotification(self, subject, text)
msg.send(self)
@@ -1301,7 +1310,8 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
except ValueError:
raise Errors.MMBadConfirmation, 'op-less data %s' % (rec,)
if op == Pending.SUBSCRIPTION:
- whence = 'via email confirmation'
+ _ = D_
+ whence = _('via email confirmation')
try:
userdesc = data[0]
# If confirmation comes from the web, context should be a
@@ -1310,7 +1320,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
# context is a Message and isn't relevant, so ignore it.
if isinstance(context, UserDesc):
userdesc += context
- whence = 'via web confirmation'
+ whence = _('via web confirmation')
addr = userdesc.address
fullname = userdesc.fullname
password = userdesc.password
@@ -1318,6 +1328,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
lang = userdesc.language
except ValueError:
raise Errors.MMBadConfirmation, 'bad subscr data %s' % (data,)
+ _ = i18n._
# Hack alert! Was this a confirmation of an invitation?
invitation = getattr(userdesc, 'invitation', False)
# We check for both 2 (approval required) and 3 (confirm +
@@ -1340,11 +1351,14 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
return op, addr, password, digest, lang
elif op == Pending.UNSUBSCRIPTION:
addr = data[0]
- # Log file messages don't need to be i18n'd
+ # Log file messages don't need to be i18n'd, but this is now in a
+ # notice.
+ _ = D_
if isinstance(context, Message.Message):
- whence = 'email confirmation'
+ whence = _('email confirmation')
else:
- whence = 'web confirmation'
+ whence = _('web confirmation')
+ _ = i18n._
# Can raise NotAMemberError if they unsub'd via other means
self.ApprovedDeleteMember(addr, whence=whence)
return op, addr