Skip to content
Snippets Groups Projects

Automatically add accounts to a known list after performing the appropriate actions

Merged Jakub Ziebinski requested to merge jziebinski/known-accounts into develop
All threads resolved!
1 file
+ 7
0
Compare changes
  • Side-by-side
  • Inline
@@ -140,6 +140,9 @@ class AccountManager:
value if isinstance(value, WorkingAccount) else WorkingAccount(Account.ensure_account_name(value))
)
if not self.is_account_known(value):
self.known.add(value)
def unset_working_account(self) -> None:
self._working_account = None
@@ -201,10 +204,14 @@ class AccountManager:
to_add = to_add[1:]
# raise AccountAlreadyExistsError if any of the accounts is already a working account
# add the account to the known list if it does not already exist there
for account in to_add:
if self.is_account_working(account):
raise AccountAlreadyExistsError(Account.ensure_account_name(account), "WorkingAccount")
if not self.is_account_known(account):
self.known.add(account)
self.watched.add(*to_add)
def remove_tracked_account(self, *to_remove: str | Account) -> None:
Loading