diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2008-10-31 16:13:59 +0000 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2008-10-31 16:13:59 +0000 |
commit | dc573a044e35581b9805606883010421d666d463 (patch) | |
tree | 4e688d6d1eafa392841c547830845ddceb50b53e /babel/messages/checkers.py | |
parent | ca01b9063fce0d17325e4a7572a475da6ddaeb4d (diff) | |
download | babel-dc573a044e35581b9805606883010421d666d463.tar.gz |
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.
Diffstat (limited to 'babel/messages/checkers.py')
-rw-r--r-- | babel/messages/checkers.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/babel/messages/checkers.py b/babel/messages/checkers.py index c07c538..3a9c80f 100644 --- a/babel/messages/checkers.py +++ b/babel/messages/checkers.py @@ -70,7 +70,8 @@ def _validate_format(format, alternative): 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. @@ -126,13 +127,6 @@ def _validate_format(format, alternative): 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: |