Example tests for services! General cleanup.
(cherry picked from commit 9f41bb4)
This commit is contained in:
@@ -42,13 +42,15 @@ class SettingsProvider(object):
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
if not os.path.exists(self.BASE_PATH):
|
||||
os.mkdir(self.BASE_PATH)
|
||||
if hasattr(self, 'BASE_PATH'):
|
||||
if not os.path.exists(self.BASE_PATH):
|
||||
os.mkdir(self.BASE_PATH)
|
||||
|
||||
def getSettings(self, area, defaults=None):
|
||||
|
||||
s = self.settings.get(area)
|
||||
if s is None:
|
||||
|
||||
if s is None and hasattr(self, 'BASE_PATH'):
|
||||
p = os.path.join(self.BASE_PATH, area)
|
||||
|
||||
if not os.path.exists(p):
|
||||
@@ -72,6 +74,8 @@ class SettingsProvider(object):
|
||||
info[item] = defaults[item]
|
||||
|
||||
self.settings[area] = s = Settings(p, info)
|
||||
else:
|
||||
s = None
|
||||
|
||||
return s
|
||||
|
||||
|
||||
Reference in New Issue
Block a user