Indent errors
This commit is contained in:
parent
74d3d8f1bb
commit
30785db477
28
cfgfile.py
28
cfgfile.py
@ -17,16 +17,16 @@ class Conf(object):
|
|||||||
cfgfile = ''
|
cfgfile = ''
|
||||||
|
|
||||||
def __init__(self, filename = None):
|
def __init__(self, filename = None):
|
||||||
"""if filename is set, open config file and initialize the ConfigParser
|
"""if filename is set, open config file and initialize the ConfigParser
|
||||||
"""
|
"""
|
||||||
if filename:
|
if filename:
|
||||||
self.setfilename(filename)
|
self.setfilename(filename)
|
||||||
# if filename
|
# if filename
|
||||||
# def __init__
|
# def __init__
|
||||||
|
|
||||||
def setfilename(self, filename):
|
def setfilename(self, filename):
|
||||||
"""initialize the ConfigParser
|
"""initialize the ConfigParser
|
||||||
"""
|
"""
|
||||||
if len(self.confobj.read(filename)) == 0 or self.confobj.read(filename)[0] != filename:
|
if len(self.confobj.read(filename)) == 0 or self.confobj.read(filename)[0] != filename:
|
||||||
raise Exception('Cannot read config file ' + filename)
|
raise Exception('Cannot read config file ' + filename)
|
||||||
# if cannot read
|
# if cannot read
|
||||||
@ -34,8 +34,8 @@ class Conf(object):
|
|||||||
# def setfilename
|
# def setfilename
|
||||||
|
|
||||||
def get(self, section, option):
|
def get(self, section, option):
|
||||||
"""returns the value of option in section
|
"""returns the value of option in section
|
||||||
"""
|
"""
|
||||||
if not self.cfgfile:
|
if not self.cfgfile:
|
||||||
raise Exception('No config file set')
|
raise Exception('No config file set')
|
||||||
# if not cfgfile
|
# if not cfgfile
|
||||||
@ -43,22 +43,22 @@ class Conf(object):
|
|||||||
# def get
|
# def get
|
||||||
|
|
||||||
def set(self, section, option, value):
|
def set(self, section, option, value):
|
||||||
"""docstring for update"""
|
"""docstring for update"""
|
||||||
self.confobj.set(section, option, value)
|
self.confobj.set(section, option, value)
|
||||||
# def set
|
# def set
|
||||||
|
|
||||||
|
|
||||||
def getitems(self, section):
|
def getitems(self, section):
|
||||||
"""returns all items in section
|
"""returns all items in section
|
||||||
"""
|
"""
|
||||||
if not self.cfgfile:
|
if not self.cfgfile:
|
||||||
raise Exception('No config file set')
|
raise Exception('No config file set')
|
||||||
# if not cfgfile
|
# if not cfgfile
|
||||||
return self.confobj.items(section)
|
return self.confobj.items(section)
|
||||||
# def getitems
|
# def getitems
|
||||||
|
|
||||||
|
def check(self, section, option):
|
||||||
|
"""checks for option in section"""
|
||||||
|
return self.confobj.has_option(section, option)
|
||||||
|
# def check
|
||||||
# class Conf
|
# class Conf
|
||||||
|
|
||||||
|
|
||||||
def check(self, section, option):
|
|
||||||
"""checks for option in section"""
|
|
||||||
return self.confobj.has_option(section, option)
|
|
Loading…
Reference in New Issue
Block a user