fix: init_path
This commit is contained in:
parent
5a212b8648
commit
ff9e643dc6
|
@ -48,18 +48,10 @@ class SimpleConfig:
|
||||||
|
|
||||||
self.wallet_config = {}
|
self.wallet_config = {}
|
||||||
self.wallet_file_exists = False
|
self.wallet_file_exists = False
|
||||||
path = None
|
self.init_path(options)
|
||||||
if options:
|
print_error( "path", self.path )
|
||||||
# this will call read_wallet_config only if there is a wallet_path value in options
|
if self.path:
|
||||||
try:
|
self.read_wallet_config(self.path)
|
||||||
path = options.wallet_path
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
if not path:
|
|
||||||
path = self.get('default_wallet_path')
|
|
||||||
print_error( "path", path )
|
|
||||||
if path:
|
|
||||||
self.read_wallet_config(path)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,10 +160,22 @@ class SimpleConfig:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def init_path(self, wallet_path):
|
def init_path(self, options):
|
||||||
"""Set the path of the wallet."""
|
"""Set the path of the wallet."""
|
||||||
if wallet_path is not None:
|
|
||||||
self.path = wallet_path
|
path = None
|
||||||
|
if options:
|
||||||
|
# this will call read_wallet_config only if there is a wallet_path value in options
|
||||||
|
try:
|
||||||
|
path = options.wallet_path
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not path:
|
||||||
|
path = self.get('default_wallet_path')
|
||||||
|
|
||||||
|
if path is not None:
|
||||||
|
self.path = path
|
||||||
return
|
return
|
||||||
|
|
||||||
# Look for wallet file in the default data directory.
|
# Look for wallet file in the default data directory.
|
||||||
|
@ -199,7 +203,6 @@ class SimpleConfig:
|
||||||
|
|
||||||
def read_wallet_config(self, path):
|
def read_wallet_config(self, path):
|
||||||
"""Read the contents of the wallet file."""
|
"""Read the contents of the wallet file."""
|
||||||
self.init_path(path)
|
|
||||||
try:
|
try:
|
||||||
with open(self.path, "r") as f:
|
with open(self.path, "r") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
Loading…
Reference in New Issue