Remove some debug prints.
This commit is contained in:
parent
2a9993cfe8
commit
441021b0cb
|
@ -61,7 +61,6 @@ class Config:
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
log.debug("Config object deconstructing..")
|
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def load(self, filename=None):
|
def load(self, filename=None):
|
||||||
|
@ -72,7 +71,6 @@ class Config:
|
||||||
filename = self.config_file
|
filename = self.config_file
|
||||||
try:
|
try:
|
||||||
# Un-pickle the file and update the config dictionary
|
# Un-pickle the file and update the config dictionary
|
||||||
log.debug("Opening pickled file for load..")
|
|
||||||
pkl_file = open(filename, "rb")
|
pkl_file = open(filename, "rb")
|
||||||
filedump = cPickle.load(pkl_file)
|
filedump = cPickle.load(pkl_file)
|
||||||
self.config.update(filedump)
|
self.config.update(filedump)
|
||||||
|
@ -80,7 +78,6 @@ class Config:
|
||||||
except IOError:
|
except IOError:
|
||||||
log.warning("IOError: Unable to load file '%s'", filename)
|
log.warning("IOError: Unable to load file '%s'", filename)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
log.debug("Closing pickled file..")
|
|
||||||
pkl_file.close()
|
pkl_file.close()
|
||||||
|
|
||||||
def save(self, filename=None):
|
def save(self, filename=None):
|
||||||
|
@ -92,22 +89,18 @@ class Config:
|
||||||
# Check to see if the current config differs from the one on disk
|
# Check to see if the current config differs from the one on disk
|
||||||
# We will only write a new config file if there is a difference
|
# We will only write a new config file if there is a difference
|
||||||
try:
|
try:
|
||||||
log.debug("Opening pickled file for comparison..")
|
|
||||||
pkl_file = open(filename, "rb")
|
pkl_file = open(filename, "rb")
|
||||||
filedump = cPickle.load(pkl_file)
|
filedump = cPickle.load(pkl_file)
|
||||||
pkl_file.close()
|
pkl_file.close()
|
||||||
if filedump == self.config:
|
if filedump == self.config:
|
||||||
# The config has not changed so lets just return
|
# The config has not changed so lets just return
|
||||||
log.debug("Not writing config file due to no changes..")
|
|
||||||
return
|
return
|
||||||
except IOError:
|
except IOError:
|
||||||
log.warning("IOError: Unable to open file: '%s'", filename)
|
log.warning("IOError: Unable to open file: '%s'", filename)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
log.debug("Opening pickled file for save..")
|
|
||||||
pkl_file = open(filename, "wb")
|
pkl_file = open(filename, "wb")
|
||||||
cPickle.dump(self.config, pkl_file)
|
cPickle.dump(self.config, pkl_file)
|
||||||
log.debug("Closing pickled file..")
|
|
||||||
pkl_file.close()
|
pkl_file.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
log.warning("IOError: Unable to save file '%s'", filename)
|
log.warning("IOError: Unable to save file '%s'", filename)
|
||||||
|
|
Loading…
Reference in New Issue