misc: fix bytes-mode warning from python-ldap
This commit is contained in:
parent
9396ab1283
commit
a76ad19afe
|
@ -1,3 +1,5 @@
|
|||
import six
|
||||
|
||||
import ldap
|
||||
from ldap.ldapobject import ReconnectLDAPObject
|
||||
from ldap.controls import SimplePagedResultsControl
|
||||
|
@ -67,4 +69,10 @@ class PagedResultsSearchObject:
|
|||
|
||||
|
||||
class PagedLDAPObject(ReconnectLDAPObject, PagedResultsSearchObject):
|
||||
pass
|
||||
def __init__(self, *args, **kwargs):
|
||||
if six.PY2 and map(int, ldap.__version__.split('.')) >= [3]:
|
||||
if 'bytes_mode' not in kwargs:
|
||||
kwargs['bytes_mode'] = False
|
||||
if 'bytes_strictness' not in kwargs:
|
||||
kwargs['bytes_strictness'] = 'silent'
|
||||
ReconnectLDAPObject.__init__(self, *args, **kwargs)
|
||||
|
|
Loading…
Reference in New Issue