Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty string for username and password in ODL settings. #2245

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Jan 13, 2025

Description

A follow-on PR for https://ebce-lyrasis.atlassian.net/browse/PP-1834 to address validation error in ODL 2.0 collection config when no specifying username and password. Validation requires a string albeit empty for a string type control. Changing the return type had undesirable ripple effects. This changes the default value from None to an empty string which seemed to me the more straightforward solution.

Motivation and Context

How Has This Been Tested?

I tested it manually on my local instance.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@dbernstein dbernstein force-pushed the allow-none-type-for-username-and-password branch 2 times, most recently from 715a94b to 99fa507 Compare January 13, 2025 20:48
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.11%. Comparing base (f417b02) to head (a70fc49).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2245   +/-   ##
=======================================
  Coverage   91.11%   91.11%           
=======================================
  Files         363      363           
  Lines       41296    41296           
  Branches     8840     8840           
=======================================
  Hits        37628    37628           
  Misses       2406     2406           
  Partials     1262     1262           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbernstein dbernstein changed the title Allow None for username and password in ODL settings. Allow empty string for username and password in ODL settings. Jan 13, 2025
@dbernstein dbernstein requested a review from tdilauro January 13, 2025 21:10
@dbernstein dbernstein force-pushed the allow-none-type-for-username-and-password branch 2 times, most recently from f83be0e to 296df19 Compare January 14, 2025 18:52
@dbernstein dbernstein force-pushed the allow-none-type-for-username-and-password branch from 296df19 to a70fc49 Compare January 14, 2025 22:03
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. I would have thought that changing the type of password to be str | None would be a better solution for consistency since the base class for the OPDS settings defines them like that, since authentication is optional there:

username: str | None = FormField(
None,
form=ConfigurationFormItem(
label=_("Username"),
description=_(
"If HTTP Basic authentication is required to access the OPDS feed (it usually isn't), enter the username here."
),
weight=-1,
),
)
password: str | None = FormField(
None,
form=ConfigurationFormItem(
label=_("Password"),
description=_(
"If HTTP Basic authentication is required to access the OPDS feed (it usually isn't), enter the password here."
),
weight=-1,
),
)

But I haven't tried making this type change, so maybe there are some consequences I'm not thinking about.

@dbernstein dbernstein merged commit 3a71e4b into main Jan 15, 2025
21 checks passed
@dbernstein dbernstein deleted the allow-none-type-for-username-and-password branch January 15, 2025 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants