Skip to content

Commit

Permalink
Set default to None for odl username and password form elements. (#2252)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernstein authored Jan 15, 2025
1 parent 3a71e4b commit 17948cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/palace/manager/api/odl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/palace/manager/api/odl/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/palace/manager/api/odl/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 17948cb

Please sign in to comment.