mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 06:58:42 +00:00
change the config class to return true or false on a save to show whether or not it was successful
This commit is contained in:
parent
c59857b802
commit
2766c103e2
1 changed files with 6 additions and 2 deletions
|
@ -251,6 +251,8 @@ class Config(object):
|
||||||
Save configuration to disk
|
Save configuration to disk
|
||||||
|
|
||||||
:param filename: if None, uses filename set in object initiliazation
|
:param filename: if None, uses filename set in object initiliazation
|
||||||
|
:rtype bool:
|
||||||
|
:return: whether or not the save succeeded.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not filename:
|
if not filename:
|
||||||
|
@ -277,7 +279,7 @@ class Config(object):
|
||||||
f.close()
|
f.close()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error("Error writing new config file: %s", e)
|
log.error("Error writing new config file: %s", e)
|
||||||
return
|
return False
|
||||||
|
|
||||||
# Make a backup of the old config
|
# Make a backup of the old config
|
||||||
try:
|
try:
|
||||||
|
@ -293,7 +295,9 @@ class Config(object):
|
||||||
shutil.move(filename + ".new", filename)
|
shutil.move(filename + ".new", filename)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error("Error moving new config file: %s", e)
|
log.error("Error moving new config file: %s", e)
|
||||||
return
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config_file(self):
|
def config_file(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue