From 193e96ee5ab02407d72ebc8fb18bc5016ee8ceb3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 12 Feb 2013 18:37:51 +0000 Subject: [PATCH] Unicode madness --- openlp/core/lib/settings.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index e9085477f..eff6a36eb 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -343,8 +343,13 @@ class Settings(QtCore.QSettings): """ # On OS X (and probably on other platforms too) empty value from QSettings is represented as type # PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type. - if setting.isNull() and isinstance(setting, QtCore.QPyNullVariant): - setting = None + # Python wants the test one way but nose wants it the other way Madness! + try: + if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull(): + setting = None + except AttributeError: + if setting.isNull() and isinstance(setting, QtCore.QPyNullVariant): + setting = None # Handle 'None' type (empty value) properly. if setting is None: # An empty string saved to the settings results in a None type being returned.