GrampsLocale: Ensure self.encoding exists before testing it

svn: r21899
This commit is contained in:
John Ralls 2013-04-05 23:40:55 +00:00
parent e21ba6c432
commit 01b4b7dc4e

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