Skip to content
Snippets Groups Projects
Commit abb9c05b authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

Fix: all types other than str will be trated as invalid account name string

parent ffd4b027
No related branches found
No related tags found
1 merge request!12Fix: all types other than str will be trated as invalid account name string
...@@ -58,19 +58,15 @@ class Accounts: ...@@ -58,19 +58,15 @@ class Accounts:
@classmethod @classmethod
def get_id(cls, name): def get_id(cls, name):
"""Get account id by name. Throw if not found.""" """Get account id by name. Throw if not found."""
if isinstance(name, list):
assert name[0] in cls._ids, "account does not exist or was not registered"
return cls._ids[name[0]]
assert name in cls._ids, "account does not exist or was not registered" assert name in cls._ids, "account does not exist or was not registered"
return cls._ids[name] return cls._ids[name]
@classmethod @classmethod
def exists(cls, name): def exists(cls, name):
"""Check if an account name exists.""" """Check if an account name exists."""
if isinstance(name, list): if isinstance(name, str):
return name[0] in cls._ids return name in cls._ids
return name in cls._ids return False
@classmethod @classmethod
def register(cls, names, block_date): def register(cls, names, block_date):
......
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