From: Armin Ronacher Date: Tue, 17 Jun 2008 19:59:02 +0000 (+0000) Subject: Fixed a small bug in the python format string checker that caused the wrong exception... X-Git-Tag: 1.0~325 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa206604760a5a45a96038ed3b7d91536482cd72;p=thirdparty%2Fbabel.git Fixed a small bug in the python format string checker that caused the wrong exception to be thrown. --- diff --git a/babel/messages/checkers.py b/babel/messages/checkers.py index 314853c4..fdee95dc 100644 --- a/babel/messages/checkers.py +++ b/babel/messages/checkers.py @@ -44,6 +44,7 @@ def num_plurals(catalog, message): def python_format(catalog, message): + """Verify the format string placeholders in the translation.""" if 'python-format' not in message.flags: return msgids = message.id @@ -114,8 +115,8 @@ def _validate_format(format, alternative): positional = name is None else: if (name is None) != positional: - raise ValueError('format string mixes positional ' - 'and named placeholders') + raise TranslationError('format string mixes positional ' + 'and named placeholders') return bool(positional) a, b = map(_parse, (format, alternative))