Wrong `NullTranslations` class in functional tests
|Reported by:||osimons||Owned by:||Jun Omae|
Add support for Babel 1.0dev.
It seems that my derived use of functional test infrastructure in plugins now fails when testing against 1.0/trunk:
File "trac/util/translation.py", line 153, in activate t.add(Translations.load(locale_dir, locale or 'en_US', AttributeError: 'NullTranslations' object has no attribute 'add'
What seems to be the case is that
t.__class__ is NullTranslations is
False as the previously imported
gettext.NullTranslations does not resolve as equal to the actual
babel.support.NullTranslations of the
t variable. However, if I run tests without Babel installed it all works fine.
Hmm. Seems this follows from recent Babel 1.0dev changes, most specifically babel:changeset:650 I guess. Reverting to Babel 0.9.6 seems to solve the issue. However, the issue does not appear when testing against latest 0.12-stable so I guess it may also be connected to some other recent changes in for 1.0dev and later.
Here is a suggestion that should perhaps catch all variants:
a b try: 146 146 self._activate_failed = True 147 147 return 148 148 t = Translations.load(locale_dir, locale or 'en_US') 149 if not t or t.__class__ is NullTranslations: 149 if not t or : 150 150 t = self._null_translations 151 151 else: 152 152 t.add(Translations.load(locale_dir, locale or 'en_US',
Change History (10)
comment:9 by , 8 years ago
|Release Notes:||modified (diff)|
|Status:||assigned → closed|