# HG changeset patch # User aronacher # Date 1216116835 0 # Node ID afa3582f7e1f0b89b052cf257f78df074c643843 # Parent dd0df1242ae32cd9717249b3122ccc671307d01e Fixed not in plural rules diff --git a/babel/plural.py b/babel/plural.py --- a/babel/plural.py +++ b/babel/plural.py @@ -363,6 +363,11 @@ return lambda self, l, r: tmpl % (self.compile(l), self.compile(r)) +def _unary_compiler(tmpl): + """Compiler factory for the `_Compiler`.""" + return lambda self, x: tmpl % self.compile(x) + + class _Compiler(object): """The compilers are able to transform the expressions into multiple output formats. @@ -375,7 +380,7 @@ compile_value = lambda x, v: str(v) compile_and = _binary_compiler('(%s && %s)') compile_or = _binary_compiler('(%s || %s)') - compile_not = _binary_compiler('(!%s)') + compile_not = _unary_compiler('(!%s)') compile_mod = _binary_compiler('(%s %% %s)') compile_is = _binary_compiler('(%s == %s)') compile_isnot = _binary_compiler('(%s != %s)') @@ -390,7 +395,7 @@ compile_and = _binary_compiler('(%s and %s)') compile_or = _binary_compiler('(%s or %s)') - compile_not = _binary_compiler('(not %s)') + compile_not = _unary_compiler('(not %s)') compile_mod = _binary_compiler('MOD(%s, %s)')