diff options
| author | Barry Warsaw | 2009-02-12 20:36:21 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-02-12 20:36:21 -0500 |
| commit | 62f4c909f90535986614a411db982bdcccaec3a1 (patch) | |
| tree | 2fe5dd3316cea73f63cb34230d848758050eade3 /src/mailman/queue | |
| parent | 2b28803e7165e91d812cd9e9e3804a6d9bdce8a1 (diff) | |
| download | mailman-62f4c909f90535986614a411db982bdcccaec3a1.tar.gz mailman-62f4c909f90535986614a411db982bdcccaec3a1.tar.zst mailman-62f4c909f90535986614a411db982bdcccaec3a1.zip | |
Much clean up of the language code, though more can be done. Factor out the
language manager stuff into a separate Language class, and be clearer in the
APIs about whether we want a language code or a Language instance.
The impetus to this was to get rid of Utils.GetCharSet(), which is done.
Diffstat (limited to 'src/mailman/queue')
| -rw-r--r-- | src/mailman/queue/__init__.py | 4 | ||||
| -rw-r--r-- | src/mailman/queue/command.py | 3 | ||||
| -rw-r--r-- | src/mailman/queue/digest.py | 8 |
3 files changed, 8 insertions, 7 deletions
diff --git a/src/mailman/queue/__init__.py b/src/mailman/queue/__init__.py index 1f284ba4d..b7c6eb1a5 100644 --- a/src/mailman/queue/__init__.py +++ b/src/mailman/queue/__init__.py @@ -434,8 +434,8 @@ class Runner: else mlist.preferred_language) else: language = mlist.preferred_language - with i18n.using_language(language): - msgdata['lang'] = language + with i18n.using_language(language.code): + msgdata['lang'] = language.code keepqueued = self._dispose(mlist, msg, msgdata) if keepqueued: self.switchboard.enqueue(msg, msgdata) diff --git a/src/mailman/queue/command.py b/src/mailman/queue/command.py index 8a7793e9e..d32361cf9 100644 --- a/src/mailman/queue/command.py +++ b/src/mailman/queue/command.py @@ -195,9 +195,10 @@ class CommandRunner(Runner): # Send a reply, but do not attach the original message. This is a # compromise because the original message is often helpful in tracking # down problems, but it's also a vector for backscatter spam. + language = config.languages[msgdata['lang']] reply = UserNotification(msg.sender, mlist.bounces_address, _('The results of your email commands'), - lang=msgdata['lang']) + lang=language) # Find a charset for the response body. Try ascii first, then # latin-1 and finally falling back to utf-8. reply_body = unicode(results) diff --git a/src/mailman/queue/digest.py b/src/mailman/queue/digest.py index e066be993..a590a9997 100644 --- a/src/mailman/queue/digest.py +++ b/src/mailman/queue/digest.py @@ -39,7 +39,7 @@ from email.mime.text import MIMEText from email.utils import formatdate, getaddresses, make_msgid from mailman import i18n -from mailman.Utils import GetCharSet, maketext, oneline, wrap +from mailman.Utils import maketext, oneline, wrap from mailman.config import config from mailman.core.errors import DiscardMessage from mailman.i18n import _ @@ -55,7 +55,7 @@ class Digester: def __init__(self, mlist, volume, digest_number): self._mlist = mlist - self._charset = GetCharSet(mlist.preferred_language) + self._charset = mlist.preferred_language.charset # This will be used in the Subject, so use $-strings. realname = mlist.real_name issue = digest_number @@ -298,8 +298,8 @@ class DigestRunner(Runner): volume = msgdata['volume'] digest_number = msgdata['digest_number'] with nested(Mailbox(msgdata['digest_path']), - i18n.using_language(mlist.preferred_language)) as ( - mailbox, language): + i18n.using_language(mlist.preferred_language.code)) as ( + mailbox, language_code): # Create the digesters. mime_digest = MIMEDigester(mlist, volume, digest_number) rfc1153_digest = RFC1153Digester(mlist, volume, digest_number) |
