From a402186d2d22f1c3a2a27c682e373039915456c5 Mon Sep 17 00:00:00 2001 From: Guillaume Tucker Date: Fri, 10 Nov 2023 13:15:38 +0100 Subject: [PATCH] api.user_manager: call UserManager parent with all arguments Rework the UserManager constructor to call the parent class with all the arguments passed using the sandard idiom. The arguments aren't used in the constructor, so this makes it entirely generic, safer and future-proof. Signed-off-by: Guillaume Tucker --- api/user_manager.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api/user_manager.py b/api/user_manager.py index 86943ae07..75da51947 100644 --- a/api/user_manager.py +++ b/api/user_manager.py @@ -28,14 +28,12 @@ class UserManager(ObjectIDIDMixin, BaseUserManager[User, PydanticObjectId]): reset_password_token_secret = settings.secret_key verification_token_secret = settings.secret_key - def __init__(self, user_db: BaseUserDatabase[User, PydanticObjectId], - password_helper: PasswordHelperProtocol | None = None): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) self._email_sender = None self._template_env = jinja2.Environment( - loader=jinja2.FileSystemLoader( - "./templates/") - ) - super().__init__(user_db, password_helper) + loader=jinja2.FileSystemLoader("./templates/") + ) @property def email_sender(self):