From 7422edc8142b8b199fd78d75c80d631603555722 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Tue, 7 Sep 2010 13:10:57 -0700 Subject: Fixed i18n._() to catch exceptions due to bad formats. Bug #632660. --- Mailman/i18n.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Mailman') diff --git a/Mailman/i18n.py b/Mailman/i18n.py index 7fe3b7ce..c2d0896c 100644 --- a/Mailman/i18n.py +++ b/Mailman/i18n.py @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 by the Free Software Foundation, Inc. +# Copyright (C) 2000-2010 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -87,7 +87,11 @@ def _(s): for k, v in dict.items(): if isinstance(v, UnicodeType): dict[k] = v.encode(charset, 'replace') - return tns % dict + try: + return tns % dict + except (ValueError, KeyError, TypeError): + # Bad interpolation format. Punt. + return tns -- cgit v1.2.3