# HG changeset patch # User aronacher # Date 1216073919 0 # Node ID 3eb859adc5deb1511d06c77dc9d9d1889f3f51c3 # Parent ecf110e7f604e3038067dba9078cbab0dc693d58 Fixed a bug in plural.py that caused a traceback for some locales, changed the `__mod__` DateTimePattern to not raise exceptions but return NotImplemented. diff --git a/babel/dates.py b/babel/dates.py --- a/babel/dates.py +++ b/babel/dates.py @@ -731,7 +731,8 @@ return self.pattern def __mod__(self, other): - assert type(other) is DateTimeFormat + if type(other) is not DateTimeFormat: + return NotImplemented return self.format % other def apply(self, datetime, locale): diff --git a/babel/plural.py b/babel/plural.py --- a/babel/plural.py +++ b/babel/plural.py @@ -351,7 +351,7 @@ def expr(self): self.expect('word', 'n') if self.skip('word', 'mod'): - return 'mod', (('n', None), self.value()) + return 'mod', (('n', ()), self.value()) return 'n', () def value(self):