1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

* Added check to getInt, so if invalid value is found it returns the default, and, if default is also invalid, returns -1.

* Added log of the exception (error log)
This commit is contained in:
Adolfo Gómez 2013-04-24 04:39:15 +00:00
parent 849ddb7512
commit f3338ee264

View File

@ -82,7 +82,12 @@ class Config(object):
try:
return int(self.get(force))
except Exception:
return self._default
logger.error('Value for {0}.{1} is invalid (integer expected)'.format(self._section, self._key))
try:
return int(self._default)
except:
logger.error('Default value for {0}.{1} is also invalid (integer expected)'.format(self._section, self._key))
return -1
def getBool(self, force = False):
if self.get(force) == '0':