Skip to content

fix: Ensure a list bind_dn_template is properly validated #289

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

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

mahendrapaipuri
Copy link
Contributor

Seems like we are ignoring the value of bind_dn_template when it is a string in validator. This PR fixes it by checking if value is of list instance and setting up the value correctly.

Seems like we are ignoring the value of `bind_dn_template` when it is a string in validator. This PR fixes it by checking if value is of list instance and setting up the value.
@@ -150,6 +150,8 @@ def _validate_bind_dn_template(self, proposal):
rv = []
if isinstance(proposal.value, str):
rv = [proposal.value]
elif isinstance(proposal.value, list):
Copy link
Member

Choose a reason for hiding this comment

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

I think this should either be an unconditional else, or there should be a separate else clause that raises a TraitError.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, makes sense. I think if the value is neither str nor list, traitlets should raise an error anyways, right?! I mean we do not need to raise it manually I imagine. If so, I will change it to unconditional else.

Copy link
Member

Choose a reason for hiding this comment

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

The allowed types are enforced by traitlets, list and strings are allowed

Copy link
Member

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

Wieee thanks for fixing this!!

@manics manics merged commit 46bc7e6 into jupyterhub:main Oct 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants