]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fix to_python when i is not provided to evaluate function
authorbenselme <benselme@gmail.com>
Fri, 9 Jan 2015 16:17:07 +0000 (11:17 -0500)
committerbenselme <benselme@gmail.com>
Fri, 9 Jan 2015 16:17:07 +0000 (11:17 -0500)
babel/plural.py

index b11b17e512309cfe9ad919c6526c25d52a63549c..7ce62e1fb39f704188640f353f8491d28c17ac70 100644 (file)
@@ -184,8 +184,8 @@ def to_python(rule):
     }
     to_python_func = _PythonCompiler().compile
     result = [
-        'def evaluate(n, v=0, w=0, f=0, t=0):',
-        ' i = int(n)',
+        'def evaluate(n, i=None, v=0, w=0, f=0, t=0):',
+        ' i = int(n) if i is None else i',
     ]
     for tag, ast in PluralRule.parse(rule).abstract:
         # the str() call is to coerce the tag to the native string.  It's