This commit is contained in:
Jude Nelson
2017-08-01 16:20:23 -04:00
parent 2384c2b6e0
commit 7735ba3d79

View File

@@ -427,7 +427,7 @@ def cli_withdraw(args, password=None, interactive=True, wallet_keys=None, config
if min_confs is None:
min_confs = TX_MIN_CONFIRMATIONS
if tx_only:
if tx_only and isinstance(tx_only, (str,unicode)):
if tx_only.lower() in ['1', 'yes', 'true']:
tx_only = True
else:
@@ -1297,6 +1297,12 @@ def cli_register(args, config_path=CONFIG_PATH, force_data=False,
min_payment_confs = getattr(args, 'min_confs', TX_MIN_CONFIRMATIONS)
unsafe_reg = getattr(args, 'unsafe_reg', 'False')
if min_payment_confs is None:
min_payment_confs = TX_MIN_CONFIRMATIONS
if unsafe_reg is None:
unsafe_reg = 'False'
if unsafe_reg.lower() in ('true', 't', 'yes', '1'):
unsafe_reg = True
else:
@@ -1307,10 +1313,7 @@ def cli_register(args, config_path=CONFIG_PATH, force_data=False,
if error:
return {'error': error}
if min_payment_confs is None:
min_payment_confs = TX_MIN_CONFIRMATIONS
else:
log.debug("Use UTXOs with a minimum of {} confirmations".format(min_payment_confs))
log.debug("Use UTXOs with a minimum of {} confirmations".format(min_payment_confs))
if transfer_address:
if not re.match(OP_BASE58CHECK_PATTERN, transfer_address):
@@ -1865,7 +1868,15 @@ def cli_migrate(args, config_path=CONFIG_PATH, password=None,
proxy = get_default_proxy(config_path=config_path)
fqu = str(args.name)
force = (force or (getattr(args, 'force', '').lower() in ['1', 'yes', 'force', 'true']))
if hasattr(args, 'force'):
force = args.force
if force is None:
force = ''
else:
force = ''
force = (force.lower() in ['1', 'yes', 'force', 'true'])
error = check_valid_name(fqu)
if error:
@@ -2941,13 +2952,23 @@ def cli_namespace_reveal(args, interactive=True, config_path=CONFIG_PATH, proxy=
infinite_lifetime = 0xffffffff # means "infinite" to blockstack-core
def _sane_default(argvec, value, default):
res = None
if hasattr(argvec, value):
res = getattr(argvec, value)
if res is None:
res = default
return res
# sane defaults
lifetime = int(getattr(args, 'lifetime', infinite_lifetime))
coeff = int(getattr(args, 'coeff', 4))
base = int(getattr(args, 'base', 4))
bucket_exponents_str = getattr(args, 'buckets', "15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0")
nonalpha_discount = int(getattr(args, 'nonalpha_discount', 2))
no_vowel_discount = int(getattr(args, 'no_vowel_discount', 5))
lifetime = int(_sane_default(args, 'lifetime', infinite_lifetime))
coeff = int(_sane_default(args, 'coeff', 4))
base = int(_sane_default(args, 'base', 4))
bucket_exponents_str = _sane_default(args, 'buckets', "15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0")
nonalpha_discount = int(_sane_default(args, 'nonalpha_discount', 2))
no_vowel_discount = int(_sane_default(args, 'no_vowel_discount', 5))
def parse_bucket_exponents(exp_str):
@@ -5178,7 +5199,7 @@ def cli_datastore_stat(args, config_path=CONFIG_PATH, interactive=False ):
"""
blockchain_id = getattr(args, 'blockchain_id', '')
if len(blockchain_id) == 0:
if blockchain_id is None or len(blockchain_id) == 0:
blockchain_id = None
else:
blockchain_id = str(blockchain_id)
@@ -5243,7 +5264,7 @@ def cli_datastore_getinode(args, config_path=CONFIG_PATH, interactive=False):
"""
blockchain_id = getattr(args, 'blockchain_id', '')
if len(blockchain_id) == 0:
if blockchain_id is None or len(blockchain_id) == 0:
blockchain_id = None
else:
blockchain_id = str(blockchain_id)
@@ -5604,7 +5625,7 @@ def cli_collection_getitem( args, config_path=CONFIG_PATH, interactive=False, pa
config_dir = os.path.dirname(config_path)
blockchain_id = getattr(args, 'blockchain_id', '')
if len(blockchain_id) == 0:
if blockchain_id is None or len(blockchain_id) == 0:
blockchain_id = None
else:
blockchain_id = str(blockchain_id)