• 
      

    Modernize the LDAP backend.

    Review Request #11355 — Created Dec. 29, 2020 and submitted

    Information

    Review Board
    release-4.0.x

    Reviewers

    This fixes up the LDAP backend to work correctly with Python 2 and 3. We
    now initialize LDAP with bytes_mode=False, which will ensure that
    python-ldap will use Unicode strings for all input and output on both
    Python 2 and 3. It's the rough equivalent of a unicode_literals
    import. That allows us to remove all the casting, which didn't work on
    Python 3 anyway without emitting warnings.

    Log output has been cleaned up, with some improved log output and a
    dedicated logger.

    The unit tests have been improved considerably. We now use spies to
    track calls, rather than overriding the LDAPObject with a per-test
    subclass. This allows us to ensure these overridden functions are
    actually called, which was just an assumption we made before.

    We didn't require LDAP support for development in the past, which meant
    that some tests recently regressed. It's now a development-time
    dependency. We also require a modern version for production.

    Unit tests pass for all versions of Python.

    Summary ID
    Modernize the LDAP backend.
    This fixes up the LDAP backend to work correctly with Python 2 and 3. We now initialize LDAP with `bytes_mode=False`, which will ensure that `python-ldap` will use Unicode strings for all input and output on both Python 2 and 3. It's the rough equivalent of a `unicode_literals` import. That allows us to remove all the casting, which didn't work on Python 3 anyway without emitting warnings. Log output has been cleaned up, with some improved log output and a dedicated logger. The unit tests have been improved considerably. We now use spies to track calls, rather than overriding the `LDAPObject` with a per-test subclass. This allows us to ensure these overridden functions are actually called, which was just an assumption we made before. We didn't require LDAP support for development in the past, which meant that some tests recently regressed. It's now a development-time dependency. We also require a modern version for production.
    ca77e76fbf4fefd2b4e75485c4855458943e0bdd
    Description From Last Updated

    F811 redefinition of unused 'test_get_or_create_user_with_given_name_attr' from line 271

    reviewbotreviewbot

    Wrapping here is a little weird--I'd say either every arg on its own line or wrap to width, but not …

    daviddavid
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    chipx86
    david
    1. Nice cleanup.

    2. reviewboard/accounts/backends/ldap.py (Diff revision 3)
       
       
       
       
      Show all issues

      Wrapping here is a little weird--I'd say either every arg on its own line or wrap to width, but not halfsies.

    3. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-4.0.x (3c7b76e)