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

Clarification needed regarding empty attributes #1149

Open
lehtoj opened this issue Jul 9, 2024 · 0 comments
Open

Clarification needed regarding empty attributes #1149

lehtoj opened this issue Jul 9, 2024 · 0 comments

Comments

@lehtoj
Copy link

lehtoj commented Jul 9, 2024

On page https://ldap3.readthedocs.io/en/latest/tutorial_searches.html#what-about-empty-attributes it says as follows: “ This feature makes it harder to access the entry in your code because you must always check if an attribute key is present before accessing its value to avoid exceptions. ldap3 helps you to write simpler code because by default it returns an empty attribute even if it is not present in the LDAP”

An example of how to check for an empty attribute value would be appreciated. The shell prints no value, but it is not clear how to check for it.

What I do, is write ldap_entry.attribute.value is not None. Not sure how this is any better than checking if the attribute exists when setting return_empty_attributes=False in connection options.

Am I missing something?

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

No branches or pull requests

1 participant