convert ints to floats if given as settings params

This commit is contained in:
Jack 2016-04-08 23:38:57 -04:00
parent 9a300d773f
commit 08e25f4622

View file

@ -420,11 +420,15 @@ class LBRYDaemon(jsonrpc.JSONRPC):
elif k == 'data_rate': elif k == 'data_rate':
if type(settings['data_rate']) is float: if type(settings['data_rate']) is float:
self.session_settings['data_rate'] = settings['data_rate'] self.session_settings['data_rate'] = settings['data_rate']
elif type(settings['data_rate']) is int:
self.session_settings['data_rate'] = float(settings['data_rate'])
else: else:
return defer.fail() return defer.fail()
elif k == 'max_key_fee': elif k == 'max_key_fee':
if type(settings['max_key_fee']) is float: if type(settings['max_key_fee']) is float:
self.session_settings['max_key_fee'] = settings['max_key_fee'] self.session_settings['max_key_fee'] = settings['max_key_fee']
elif type(settings['max_key_fee']) is int:
self.session_settings['max_key_fee'] = float(settings['max_key_fee'])
else: else:
return defer.fail() return defer.fail()
elif k == 'default_download_directory': elif k == 'default_download_directory':
@ -438,11 +442,15 @@ class LBRYDaemon(jsonrpc.JSONRPC):
elif k == 'max_upload': elif k == 'max_upload':
if type(settings['max_upload']) is float: if type(settings['max_upload']) is float:
self.session_settings['max_upload'] = settings['max_upload'] self.session_settings['max_upload'] = settings['max_upload']
elif type(settings['max_upload']) is int:
self.session_settings['max_upload'] = float(settings['max_upload'])
else: else:
return defer.fail() return defer.fail()
elif k == 'max_download': elif k == 'max_download':
if type(settings['max_download']) is float: if type(settings['max_download']) is float:
self.session_settings['max_download'] = settings['max_download'] self.session_settings['max_download'] = settings['max_download']
if type(settings['max_download']) is int:
self.session_settings['max_download'] = float(settings['max_download'])
else: else:
return defer.fail() return defer.fail()
elif k == 'upload_log': elif k == 'upload_log':
@ -828,6 +836,8 @@ class LBRYDaemon(jsonrpc.JSONRPC):
Returns true if daemon completed startup, otherwise returns false Returns true if daemon completed startup, otherwise returns false
""" """
log.info("[" + str(datetime.now()) + "] is_running: " + str(self.announced_startup))
if self.announced_startup: if self.announced_startup:
return self._render_response(True, OK_CODE) return self._render_response(True, OK_CODE)
else: else: