summaryrefslogtreecommitdiffstats
path: root/pyfirstaidkit
diff options
context:
space:
mode:
authorMartin Sivak <msivak@redhat.com>2008-04-09 16:49:15 +0200
committerMartin Sivak <msivak@redhat.com>2008-04-09 16:49:15 +0200
commit3a3b51188aff5f8f2e1067c3b809a8a1c41976ce (patch)
tree568599105cfc3f632205828a2bda2f822e063187 /pyfirstaidkit
parent02d233a00205e62cb0f0e142f17a3ef456b6e125 (diff)
downloadfirstaidkit-3a3b51188aff5f8f2e1067c3b809a8a1c41976ce.tar.gz
firstaidkit-3a3b51188aff5f8f2e1067c3b809a8a1c41976ce.tar.xz
firstaidkit-3a3b51188aff5f8f2e1067c3b809a8a1c41976ce.zip
Honor the DEFAULT section in configuration file
Diffstat (limited to 'pyfirstaidkit')
-rw-r--r--pyfirstaidkit/configuration.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pyfirstaidkit/configuration.py b/pyfirstaidkit/configuration.py
index 94a3243..b57ffc9 100644
--- a/pyfirstaidkit/configuration.py
+++ b/pyfirstaidkit/configuration.py
@@ -71,7 +71,7 @@ class FAKConfigSection(object):
self.__dict__["configuration"] = cfg
def __getattr__(self, key):
- if not self.__dict__["configuration"].has_section(self.__dict__["section_name"]):
+ if not self.__dict__["configuration"].has_section(self.__dict__["section_name"]) and self.__dict__["section_name"]!="DEFAULT":
raise ConfigParser.NoSectionError(self.__dict__["section_name"])
if not self.__dict__["configuration"].has_option(self.__dict__["section_name"], key):
@@ -83,7 +83,7 @@ class FAKConfigSection(object):
if self.__dict__["configuration"].__dict__.has_key("_lock") and self.__dict__["configuration"].__dict__["_lock"]:
raise LockedError(key)
- if not self.__dict__["configuration"].has_section(self.__dict__["section_name"]):
+ if not self.__dict__["configuration"].has_section(self.__dict__["section_name"]) and self.__dict__["section_name"]!="DEFAULT":
self.__dict__["configuration"].add_section(self.__dict__["section_name"])
self.__dict__["configuration"].set(self.__dict__["section_name"], key, value)
@@ -98,7 +98,7 @@ class FAKConfigSection(object):
def valueItems(self):
"""Usefull when you don't care about the name of the items."""
- if not self.__dict__["configuration"].has_section(self.__dict__["section_name"]):
+ if not self.__dict__["configuration"].has_section(self.__dict__["section_name"]) and self.__dict__["section_name"]!="DEFAULT":
raise ConfigParser.NoSectionError(self.__dict__["section_name"])
tmpList = self.__dict__["configuration"].items(self.__dict__["section_name"])
retVal = []