From c3c77b23ae78dd95e7b501419de18363724a593e Mon Sep 17 00:00:00 2001 From: Carsten Schabacker Date: Tue, 6 Feb 2024 18:13:44 +0100 Subject: [PATCH] Update find_account, allow search for all properties still not finished --- ActiveCollabAPI/ACAuthenticator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ActiveCollabAPI/ACAuthenticator.py b/ActiveCollabAPI/ACAuthenticator.py index 7d6f8d6..0c96fb6 100644 --- a/ActiveCollabAPI/ACAuthenticator.py +++ b/ActiveCollabAPI/ACAuthenticator.py @@ -40,9 +40,9 @@ class ACAuthenticator: self.accounts = login_res['accounts'] return login_res - def find_account(self, value, field='user_display_name'): - found = list(filter(lambda a: a[field] == value, + def find_account(self, value, key='user_display_name'): + found = list(filter(lambda a: a[key] == value, self.accounts)) if len(found) == 0: - raise Exception("Account '%s' not found!" % name) + raise Exception("Account '%s=%s' not found!" % (key, value)) return found[0]