Skip to content

Conversation

@thraxil
Copy link
Contributor

@thraxil thraxil commented Jun 2, 2016

python-ldap doesn't work with python3 and is apparently stalled out.

This adds transparent support for ldap3, which is python3 compatible and will let us move forward on that.

As implemented here, if the ldap3 library is importable, it uses that. Otherwise, it falls back to python-ldap.

My suggested plan is to get this out in a new release. Then we can go app by app adding ldap3. Once all of our applications are using that, we can remove the old python-ldap support.

some additional notes:

  • some of the varialble names are weird camelCase. that's a bit of a holdover from the old ldap code, which I decided to stick to as closely as possible at first. I think when we get rid of the python-ldap stuff, that can be cleaned up and modernized.
  • the ldap stuff should probably be completely split out of djangowind into its own package. Again, that can happen after the transition.
  • I didn't quite have it in me to mock out ldap to properly test that functionality. So I've just been manually testing that bit for now. Eventually though...

@coveralls
Copy link

coveralls commented Jun 2, 2016

Coverage Status

Coverage decreased (-1.2%) to 75.2% when pulling c91ee9b on ldap3 into b7b6d3f on master.

if not user.last_name or not user.first_name:
try:
r = ldap_lookup(user.username)
r = self.ldap_lookup(user.username)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this still result in an ImportError exception? self.ldap_lookup will just be undefined here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Forgot the default implementation...

@coveralls
Copy link

coveralls commented Jun 3, 2016

Coverage Status

Coverage decreased (-1.3%) to 75.057% when pulling b13d75c on ldap3 into b7b6d3f on master.

if not user.email:
user.email = user.username + "@columbia.edu"
if not user.last_name or not user.first_name:
try:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool. And, can this try/catch be removed as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

@sdreher sdreher merged commit 7f56a86 into master Jun 3, 2016
@sdreher sdreher deleted the ldap3 branch June 3, 2016 13:14
@coveralls
Copy link

coveralls commented Jun 3, 2016

Coverage Status

Coverage decreased (-1.07%) to 75.314% when pulling 465a93e on ldap3 into b7b6d3f on master.

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.

4 participants