generate docs

This commit is contained in:
Lex Berezhny 2019-09-03 11:30:10 -04:00
parent d2ad3e7ff1
commit 36fbd91280
4 changed files with 204 additions and 108 deletions

File diff suppressed because one or more lines are too long

View file

@ -377,12 +377,11 @@ class BaseConfig:
@contextmanager @contextmanager
def update_config(self): def update_config(self):
if not isinstance(self.persisted, ConfigFileAccess):
raise TypeError("Config file cannot be updated.")
self._updating_config = True self._updating_config = True
yield self yield self
self._updating_config = False self._updating_config = False
self.persisted.save() if isinstance(self.persisted, ConfigFileAccess):
self.persisted.save()
@property @property
def modify_order(self): def modify_order(self):

View file

@ -1045,6 +1045,8 @@ class Daemon(metaclass=JSONRPCServerType):
(dict) Dictionary with key/value of new preference (dict) Dictionary with key/value of new preference
""" """
account = self.get_account_or_default(account_id) account = self.get_account_or_default(account_id)
if value and isinstance(value, str) and value[0] in ('[', '{'):
value = json.loads(value)
account.preferences[key] = value account.preferences[key] = value
account.modified_on = time.time() account.modified_on = time.time()
self.default_wallet.save() self.default_wallet.save()

View file

@ -78,11 +78,31 @@ class Examples(CommandTestCase):
'Get version', 'Get version',
'version' 'version'
) )
# settings
await r( await r(
'Get settings', 'Get settings',
'settings', 'get' 'settings', 'get'
) )
await r(
'Set settings',
'settings', 'set', '"tcp_port"', '99'
)
# preferences
await r(
'Set preference',
'preference', 'set', '"theme"', '"dark"'
)
await r(
'Get preferences',
'preference', 'get'
)
# accounts # accounts
await r( await r(