# HG changeset patch # User aronacher # Date 1216073919 0 # Node ID da59f8723587ce756a348d2fec805c4d010e4e20 # Parent c5bc0f6822a9220695053d81e577440a2fbbcd84 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):