# HG changeset patch # User jruigrok # Date 1270977049 0 # Node ID 58bd100bb5edda02bd6ff294989512dc08544c3a # Parent 1112a03f4d74d7c2c05f742bf33ec478de0a6265 Merged revisions 458 via svnmerge from http://svn.edgewall.org/repos/babel/trunk ........ r458 | aronacher | 2008-10-31 17:13:59 +0100 (vr, 31 okt 2008) | 3 lines Removed `ValueError` raising for string formatting message checkers if the string does not contain any string formattings. The new behavior is undefined. This fixes at least one of the problems of the #150 ticket. ........ diff --git a/0.9.x/ChangeLog b/0.9.x/ChangeLog --- a/0.9.x/ChangeLog +++ b/0.9.x/ChangeLog @@ -18,6 +18,8 @@ * Add a __ne__() method to the Local class. * Explicitly sort instead of using sorted() and don't assume ordering (Python 2.3 and Jython compatibility). + * Removed ValueError raising for string formatting message checkers if the + string does not contain any string formattings (ticket #150). Version 0.9.5 diff --git a/0.9.x/babel/messages/checkers.py b/0.9.x/babel/messages/checkers.py --- a/0.9.x/babel/messages/checkers.py +++ b/0.9.x/babel/messages/checkers.py @@ -69,7 +69,8 @@ arguments are not interchangeable as `alternative` may contain less placeholders if `format` uses named placeholders. - If `format` does not use string formatting a `ValueError` is raised. + The behavior of this function is undefined if the string does not use + string formattings. If the string formatting of `alternative` is compatible to `format` the function returns `None`, otherwise a `TranslationError` is raised. @@ -125,13 +126,6 @@ a, b = map(_parse, (format, alternative)) - # if a does not use string formattings, we are dealing with invalid - # input data. This function only works if the first string provided - # does contain string format chars - if not a: - raise ValueError('original string provided does not use string ' - 'formatting.') - # now check if both strings are positional or named a_positional, b_positional = map(_check_positional, (a, b)) if a_positional and not b_positional and not b: