[r21899]GrampsLocale: Ensure self.encoding exists before testing it

svn: r21901
This commit is contained in:
John Ralls 2013-04-05 23:54:58 +00:00
parent 2eafc3ca08
commit 5dc89962ba

View File

@ -347,7 +347,7 @@ class GrampsLocale(object):
#Next, we need to know what is the encoding from the native #Next, we need to know what is the encoding from the native
#environment. This is used by python standard library funcions which #environment. This is used by python standard library funcions which
#localize their output, e.g. time.strftime(): #localize their output, e.g. time.strftime():
if not self.encoding: if not (hasattr(self, 'encoding') and self.encoding):
self.encoding = (locale.getpreferredencoding() self.encoding = (locale.getpreferredencoding()
or sys.getdefaultencoding()) or sys.getdefaultencoding())
#Ensure that output is encoded correctly to stdout and stderr. This is #Ensure that output is encoded correctly to stdout and stderr. This is