diff options
| author | bwarsaw | 2007-03-21 14:11:53 +0000 |
|---|---|---|
| committer | bwarsaw | 2007-03-21 14:11:53 +0000 |
| commit | fc51f4c9de9751c03fb21394b393253e8c225453 (patch) | |
| tree | a931a2a61e156ca8332a92d6369163741f8e506d /Mailman/Handlers | |
| parent | cf950f7430ecabc8d4ff370c4f9e6e01f7b44fd4 (diff) | |
| download | mailman-fc51f4c9de9751c03fb21394b393253e8c225453.tar.gz mailman-fc51f4c9de9751c03fb21394b393253e8c225453.tar.zst mailman-fc51f4c9de9751c03fb21394b393253e8c225453.zip | |
Test suite repair. All tests are now passing again.
- In i18n.py, change this method so that everything it returns will be
guaranteed to be a unicode. Mailman 2.2 will be unicode-safe, meaning all
strings internally will be unicodes. The translation service is one
boundary point were strings come from the outside, so ensure that they are
unicodes and convert if necessary. This may break some things, but it's
better to fix those situations than to continue to return 8-bit strings from
_().
- In Mailman/testing/base.py, craft a fake module called Mailman.MTA.stub and
stick no-op functions on stub.create() and stub.remove(). We really don't
need the MTA modules for testing purposes (yet at least), and if you're
using the default configuration, you'll get tons of cruft on stdout when the
Manual MTA tries to add and remove mailing lists.
Set up the test configuration environment to use this stub MTA module.
- In test_handlers.py, remove an extraneous str().
- Convert ToDigest.py, Hold.py and Acknowledge.py to __i18n_templates__. (I'm
pretty darn close to just making everything use $-strings by default.)
- In CookHeaders.py, there's no need to unicode()-ify the subject since that
should already be a unicode when passed from _().
- In MailList.py, we can use the str.capitalize() method.
Diffstat (limited to 'Mailman/Handlers')
| -rw-r--r-- | Mailman/Handlers/Acknowledge.py | 4 | ||||
| -rw-r--r-- | Mailman/Handlers/CookHeaders.py | 1 | ||||
| -rw-r--r-- | Mailman/Handlers/Hold.py | 16 | ||||
| -rw-r--r-- | Mailman/Handlers/ToDigest.py | 5 |
4 files changed, 15 insertions, 11 deletions
diff --git a/Mailman/Handlers/Acknowledge.py b/Mailman/Handlers/Acknowledge.py index 609f6ea8a..d02920cde 100644 --- a/Mailman/Handlers/Acknowledge.py +++ b/Mailman/Handlers/Acknowledge.py @@ -29,6 +29,8 @@ from Mailman import Utils from Mailman.configuration import config from Mailman.i18n import _ +__i18n_templates__ = True + def process(mlist, msg, msgdata): @@ -57,7 +59,7 @@ def process(mlist, msg, msgdata): # Craft the outgoing message, with all headers and attributes # necessary for general delivery. Then enqueue it to the outgoing # queue. - subject = _('%(realname)s post acknowledgement') + subject = _('$realname post acknowledgement') usermsg = Message.UserNotification(sender, mlist.GetBouncesEmail(), subject, text, lang) usermsg.send(mlist) diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index c28ec25ab..11f08acc8 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -276,7 +276,6 @@ def prefix_subject(mlist, msg, msgdata): if subject.strip() == '': subject = _('(no subject)') cset = Utils.GetCharSet(mlist.preferred_language) - subject = unicode(subject, cset) # and substitute %d in prefix with post_id try: prefix = prefix % mlist.post_id diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index 180b6fd70..d13babba6 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -49,6 +49,8 @@ log = logging.getLogger('mailman.vette') def _(s): return s +__i18n_templates__ = True + class ForbiddenPoster(Errors.HoldMessage): @@ -84,8 +86,8 @@ class Administrivia(Errors.HoldMessage): listurl = mlist.GetScriptURL('listinfo', absolute=1) request = mlist.GetRequestEmail() return _("""Please do *not* post administrative requests to the mailing -list. If you wish to subscribe, visit %(listurl)s or send a message with the -word `help' in it to the request address, %(request)s, for further +list. If you wish to subscribe, visit $listurl or send a message with the +word `help' in it to the request address, $request, for further instructions.""") class SuspiciousHeaders(Errors.HoldMessage): @@ -100,13 +102,13 @@ class MessageTooBig(Errors.HoldMessage): def reason_notice(self): size = self.__msgsize limit = self.__limit - return _('''Message body is too big: %(size)d bytes with a limit of -%(limit)d KB''') + return _('''Message body is too big: $size bytes with a limit of +$limit KB''') def rejection_notice(self, mlist): kb = self.__limit return _('''Your message was too big; please trim it to less than -%(kb)d KB in size.''') +$kb KB in size.''') class ModeratedNewsgroup(ModeratedPost): reason = _('Posting to a moderated newsgroup') @@ -244,7 +246,7 @@ def hold_for_approval(mlist, msg, msgdata, exc): d['confirmurl'] = '%s/%s' % (mlist.GetScriptURL('confirm', absolute=1), cookie) lang = msgdata.get('lang', mlist.getMemberLanguage(sender)) - subject = _('Your message to %(listname)s awaits moderator approval') + subject = _('Your message to $listname awaits moderator approval') text = Utils.maketext('postheld.txt', d, lang=lang, mlist=mlist) nmsg = Message.UserNotification(sender, adminaddr, subject, text, lang) nmsg.send(mlist) @@ -263,7 +265,7 @@ def hold_for_approval(mlist, msg, msgdata, exc): d['reason'] = _(reason) d['subject'] = usersubject # craft the admin notification message and deliver it - subject = _('%(listname)s post from %(sender)s requires approval') + subject = _('$listname post from $sender requires approval') nmsg = Message.UserNotification(owneraddr, owneraddr, subject, lang=lang) nmsg.set_type('multipart/mixed') diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 3b22c6cee..e43cb68ce 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -54,6 +54,7 @@ from Mailman.Queue.sbcache import get_switchboard from Mailman.configuration import config _ = i18n._ +__i18n_templates__ = True UEMPTYSTRING = u'' EMPTYSTRING = '' @@ -146,7 +147,7 @@ def send_i18n_digests(mlist, mboxfp): realname = mlist.real_name volume = mlist.volume issue = mlist.next_digest_number - digestid = _('%(realname)s Digest, Vol %(volume)d, Issue %(issue)d') + digestid = _('$realname Digest, Vol $volume, Issue $issue') digestsubj = Header(digestid, lcset, header_name='Subject') # Set things up for the MIME digest. Only headers not added by # CookHeaders need be added here. @@ -292,7 +293,7 @@ def send_i18n_digests(mlist, mboxfp): toctext = toc.getvalue() # MIME tocpart = MIMEText(toctext.encode(lcset), _charset=lcset) - tocpart['Content-Description']= _("Today's Topics (%(msgcount)d messages)") + tocpart['Content-Description']= _("Today's Topics ($msgcount messages)") mimemsg.attach(tocpart) # RFC 1153 print >> plainmsg, toctext |
