Skip to content
Snippets Groups Projects
Commit dcff407d authored by Fabian Schuh's avatar Fabian Schuh
Browse files

[account] Allow to properly use Account objects in __init__()

parent 81456771
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,6 @@ class Account(dict): ...@@ -12,7 +12,6 @@ class Account(dict):
bitshares_instance=None bitshares_instance=None
): ):
self.cached = False self.cached = False
self.name = account.strip().lower()
self.full = full self.full = full
if not bitshares_instance: if not bitshares_instance:
...@@ -23,9 +22,12 @@ class Account(dict): ...@@ -23,9 +22,12 @@ class Account(dict):
super(Account, self).__init__(account) super(Account, self).__init__(account)
self.name = account["name"] self.name = account["name"]
self.cached = True self.cached = True
elif isinstance(account, str):
if not lazy and not self.cached: self.name = account.strip().lower()
self.refresh() if not lazy:
self.refresh()
else:
raise ValueError("Account() expects an account name, id or an instance of Account")
def refresh(self): def refresh(self):
account = self.bitshares.rpc.get_account(self.name) account = self.bitshares.rpc.get_account(self.name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment