Skip to content

Feb 10 change to ldap_attribute_store.py broke 'no ldap record found'. #488

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

Open
aaschenbrener opened this issue Apr 24, 2025 · 0 comments

Comments

@aaschenbrener
Copy link

aaschenbrener commented Apr 24, 2025

Previously there was a section of code that started on line 586 which handles whether or not an LDAP record was found. It takes the following format.

if record:
    ...
else:
   ...

On the commit found here: 4b9c83b
That got nested under a for loop in attempt to process multiple records like such:

for record in responses:
    if record:
        ...
    else:
        ...

The problem is that if no record exists in responses, the else clause will never be executed, because the for loop will be entirely skipped. (That is of course after you get passed the error of 'responses' not being assigned: "UnboundLocalError: local variable 'responses' referenced before").

It's likely that it was intended to be something like below instead.

# Address responses being an Unboundlocal when no record is found, then...

if responses:
    for record in responses:
        ...
else:
    ...

I've posted the Pull Request to resolve this: Fix for issue 488

@aaschenbrener aaschenbrener mentioned this issue May 6, 2025
6 tasks
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