Add pyldap_version constant to allow ID of ldap implementation.

Bug Description:  Pyldap changes *just* enough to break compatability between
python ldap, and pyldap.

Fix Description:  To allow users to detect what behaviour they need to use,
they can look for the "well known" flag ldap.PYLDAP_VERSION. If it doesn't
exist, then we it can be determined we are on python-ldap.

The following pattern can be used:

if hasattr(ldap, 'PYLDAP_VERSION'):
    # Do pyldap behaviour
else:
    # Do python-ldap behaviour
This commit is contained in:
William Brown 2016-02-18 15:50:33 +10:00
parent b323ffd746
commit 47b1a0d05a
1 changed files with 2 additions and 0 deletions

View File

@ -22,6 +22,8 @@ if __debug__:
import _ldap
from _ldap import *
PYLDAP_VERSION = __version__
OPT_NAMES_DICT = {}
for k,v in vars(_ldap).items():
if k.startswith('OPT_'):