From 17948cb23dfb3b979f62a33168a77964bb5ceb53 Mon Sep 17 00:00:00 2001 From: dbernstein Date: Wed, 15 Jan 2025 13:03:40 -0800 Subject: [PATCH] Set default to None for odl username and password form elements. (#2252) --- src/palace/manager/api/odl/api.py | 4 ++-- src/palace/manager/api/odl/importer.py | 4 ++-- src/palace/manager/api/odl/settings.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/palace/manager/api/odl/api.py b/src/palace/manager/api/odl/api.py index 5556484f6..32fa18441 100644 --- a/src/palace/manager/api/odl/api.py +++ b/src/palace/manager/api/odl/api.py @@ -130,11 +130,11 @@ def __init__( @cached_property def _username(self) -> str: - return self.settings.username + return self.settings.username if self.settings.username else "" @cached_property def _password(self) -> str: - return self.settings.password + return self.settings.password if self.settings.password else "" @cached_property def _auth_type(self) -> OPDS2AuthType: diff --git a/src/palace/manager/api/odl/importer.py b/src/palace/manager/api/odl/importer.py index 8ab9bbeb5..5d93922d6 100644 --- a/src/palace/manager/api/odl/importer.py +++ b/src/palace/manager/api/odl/importer.py @@ -385,11 +385,11 @@ def __init__( @property def _username(self) -> str: - return self.settings.username + return self.settings.username if self.settings.username else "" @property def _password(self) -> str: - return self.settings.password + return self.settings.password if self.settings.password else "" @property def _auth_type(self) -> OPDS2AuthType: diff --git a/src/palace/manager/api/odl/settings.py b/src/palace/manager/api/odl/settings.py index c1d50f8cc..3ef8444eb 100644 --- a/src/palace/manager/api/odl/settings.py +++ b/src/palace/manager/api/odl/settings.py @@ -77,15 +77,15 @@ class OPDS2WithODLSettings(OPDS2ImporterSettings): options={auth: auth.value for auth in OPDS2AuthType}, ), ) - password: str = FormField( - default="", + password: str | None = FormField( + default=None, form=ConfigurationFormItem( label=_("Library's API password"), required=False, ), ) - username: str = FormField( - default="", + username: str | None = FormField( + default=None, form=ConfigurationFormItem( label=_("Library's API username"), required=False,