changeset 353:0791b3bf42cc trunk

Fixed a small bug in the python format string checker that caused the wrong exception to be thrown.
author aronacher
date Tue, 17 Jun 2008 19:59:02 +0000
parents 8860097a9765
children 13c968efa492
files babel/messages/checkers.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/babel/messages/checkers.py
+++ b/babel/messages/checkers.py
@@ -44,6 +44,7 @@
 
 
 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 @@
                 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))
Copyright (C) 2012-2017 Edgewall Software