Skip to content

Commit

Permalink
api.user_manager: call UserManager parent with all arguments
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
gctucker committed Nov 10, 2023
1 parent 9c29602 commit 069c0d9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions api/user_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Check warning on line 39 in api/user_manager.py

View workflow job for this annotation

GitHub Actions / Lint

Missing function or method docstring
Expand Down

0 comments on commit 069c0d9

Please sign in to comment.