From: Armin Ronacher Date: Mon, 14 Jul 2008 22:18:39 +0000 (+0000) Subject: Fixed a bug in plural.py that caused a traceback for some locales, changed the `__mod... X-Git-Tag: 1.0~294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ca4415400c142d0b45bee7f3c53641d4742fc9c;p=thirdparty%2Fbabel.git 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 index 28020043..5e2723ab 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -731,7 +731,8 @@ class DateTimePattern(object): 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 index c7cf41e8..dd50edef 100644 --- a/babel/plural.py +++ b/babel/plural.py @@ -351,7 +351,7 @@ class _Parser(object): 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):