红联Linux门户
Linux帮助

[trac] Fix AttributeError: 'NullTranslations' object has

发布时间:2016-12-11 15:05:25来源:blog.csdn.net/robertsong2004作者:HaveFunInLinux
问题说明:
在ubuntu14.04下,trac启动时会出现如下问题:
Traceback (most recent call last):
File "/usr/bin/trac-admin", line 9, in <module>
load_entry_point('Trac==1.0.1', 'console_scripts', 'trac-admin')()
File "/usr/lib/python2.7/dist-packages/trac/admin/console.py", line 567, in run
translation.activate(locale)
File "/usr/lib/python2.7/dist-packages/trac/util/translation.py", line 325, in activate
translations.activate(locale, env_path)
File "/usr/lib/python2.7/dist-packages/trac/util/translation.py", line 152, in activate
t.add(Translations.load(locale_dir, locale or 'en_US',
AttributeError: 'NullTranslations' object has no attribute 'add'
 
修改方法:
参考:
[trac] Fix AttributeError: 'NullTranslations' object has
的修改,即可对应该问题。
Index: branches/1.0-stable/trac/util/translation.py  
================================================= 
--- a/branches/1.0-stable/trac/util/translation.py  
+++ b/branches/1.0-stable/trac/util/translation.py  
@@ -147,5 +147,5 @@  
return  
t = Translations.load(locale_dir, locale or 'en_US')  
-            if not t or t.__class__ is NullTranslations:  
+            if not isinstance(t, Translations):  
t = self._null_translations  
else:
 
本文永久更新地址:http://www.linuxdiyf.com/linux/26805.html