summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2002-02-11 23:03:06 +0000
committerbwarsaw2002-02-11 23:03:06 +0000
commitff6be3d5ef7f34836ddbac8cbd1b571e9ae68281 (patch)
tree221c10f78c0aae940fd533d508822e2506d71689
parentdad77e478204fd629f521a4a4c7fda2f372fe193 (diff)
downloadmailman-ff6be3d5ef7f34836ddbac8cbd1b571e9ae68281.tar.gz
mailman-ff6be3d5ef7f34836ddbac8cbd1b571e9ae68281.tar.zst
mailman-ff6be3d5ef7f34836ddbac8cbd1b571e9ae68281.zip
__handlepost(), HoldSubscription(): When creating the UserNotification
message object, pass in the language that the message should be in. This allows us to get the character set and header encodings right. Note that in the former method, we try to set the language to the forwarding address, if it is a member of the list. If not, the list's preferred language will be used. Patch by Ben Gertzfield, with modifications by Barry.
-rw-r--r--Mailman/ListAdmin.py31
1 files changed, 20 insertions, 11 deletions
diff --git a/Mailman/ListAdmin.py b/Mailman/ListAdmin.py
index 18d736adc..dc60a8b77 100644
--- a/Mailman/ListAdmin.py
+++ b/Mailman/ListAdmin.py
@@ -39,7 +39,9 @@ from Mailman import Errors
from Mailman.UserDesc import UserDesc
from Mailman.Queue.sbcache import get_switchboard
from Mailman.Logging.Syslog import syslog
-from Mailman.i18n import _
+from Mailman import i18n
+
+_ = i18n._
# Request types requiring admin approval
IGN = 0
@@ -294,12 +296,21 @@ class ListAdmin:
except IOError, e:
if e.errno <> errno.ENOENT: raise
raise Errors.LostHeldMessage(path)
- fmsg = Message.UserNotification(addr,
- self.GetAdminEmail(),
- _('Forward of moderated message'))
- fmsg['Content-Type'] = 'message/rfc822'
- fmsg['MIME-Version'] = '1.0'
- fmsg.set_payload(copy)
+ # If the address getting the forwarded message is a member of the
+ # list, we want the headers of the outer message to be encoded in
+ # their language. Otherwise it'll be the preferred language of
+ # the mailing list.
+ lang = self.getMemberLanguage(addr)
+ otrans = i18n.get_translation()
+ i18n.set_language(lang)
+ try:
+ fmsg = Message.UserNotification(
+ addr, self.GetAdminEmail(),
+ _('Forward of moderated message'),
+ copy, lang)
+ finally:
+ i18n.set_translation(otrans)
+ fmsg.set_type('message/rfc822')
fmsg.send(self)
# Log the rejection
if rejection:
@@ -365,10 +376,8 @@ class ListAdmin:
# This message should appear to come from the <list>-owner so as
# to avoid any useless bounce processing.
owneraddr = self.GetOwnerEmail()
- msg = Message.UserNotification(owneraddr, owneraddr, subject, text)
- msg['MIME-Version'] = '1.0'
- msg.add_header('Content-Type', 'text/plain',
- charset=Utils.GetCharSet(self.preferred_language))
+ msg = Message.UserNotification(owneraddr, owneraddr, subject, text,
+ self.preferred_language)
msg.send(self, **{'tomoderators': 1})
def __handlesubscription(self, record, value, comment):