Use BMConfigParser.safeGetBoolean() in the methods for send* API commands

This commit is contained in:
Dmitri Bogomolov 2021-11-29 17:30:39 +02:00
parent 006632f5d1
commit 0a2470ebb7
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -1117,10 +1117,8 @@ class BMRPCDispatcher(object):
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
fromAddress = addBMIfNotPresent(fromAddress) fromAddress = addBMIfNotPresent(fromAddress)
self._verifyAddress(fromAddress) self._verifyAddress(fromAddress)
try: fromAddressEnabled = self.config.safeGetBoolean(fromAddress, 'enabled')
fromAddressEnabled = self.config.getboolean( if fromAddressEnabled is None:
fromAddress, 'enabled')
except BaseException:
raise APIError( raise APIError(
13, 'Could not find your fromAddress in the keys.dat file.') 13, 'Could not find your fromAddress in the keys.dat file.')
if not fromAddressEnabled: if not fromAddressEnabled:
@ -1163,9 +1161,7 @@ class BMRPCDispatcher(object):
TTL = 28 * 24 * 60 * 60 TTL = 28 * 24 * 60 * 60
fromAddress = addBMIfNotPresent(fromAddress) fromAddress = addBMIfNotPresent(fromAddress)
self._verifyAddress(fromAddress) self._verifyAddress(fromAddress)
try: if not self.config.safeGetBoolean(fromAddress, 'enabled'):
self.config.getboolean(fromAddress, 'enabled')
except BaseException:
raise APIError( raise APIError(
13, 'Could not find your fromAddress in the keys.dat file.') 13, 'Could not find your fromAddress in the keys.dat file.')
toAddress = str_broadcast_subscribers toAddress = str_broadcast_subscribers