[hamster-applet/windows] Prevent reading empty strings from configuration file
- From: Matthew Howle <mdhowle src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet/windows] Prevent reading empty strings from configuration file
- Date: Sun, 1 May 2011 17:41:24 +0000 (UTC)
commit ba42548ef218141d0dac09373450d6efe4f0c859
Author: Matthew Howle <matthew howle org>
Date: Sun Apr 17 21:38:52 2011 -0400
Prevent reading empty strings from configuration file
src/hamster/configuration.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/hamster/configuration.py b/src/hamster/configuration.py
index 63a1500..9c75a61 100644
--- a/src/hamster/configuration.py
+++ b/src/hamster/configuration.py
@@ -233,7 +233,10 @@ class INIStore(gobject.GObject, Singleton):
if vtype is bool:
return self._client.getboolean(self.SECTION, key)
elif vtype is str:
- return self._client.get(self.SECTION, key)
+ temp = self._client.get(self.SECTION, key)
+ if not temp:
+ return None
+ return temp
elif vtype is int:
return self._client.getint(self.SECTION, key)
elif vtype in (list, tuple):
@@ -241,6 +244,8 @@ class INIStore(gobject.GObject, Singleton):
temp = self._client.get(self.SECTION, key)
for i in temp.split(','):
l.append(i.strip())
+ if not l:
+ return None
return l
except configparser.NoOptionError:
return None
@@ -248,6 +253,8 @@ class INIStore(gobject.GObject, Singleton):
return None
except AttributeError:
return None
+ except ValueError:
+ return None
return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]