URL: https://github.com/freeipa/freeipa/pull/1390
Author: tiran
 Title: #1390: Require python-ldap 3.0.0b2
Action: opened

PR body:
"""
Use new LDAPBytesWarning to ignore python-ldap's bytes warnings. New
build is available in @freeipa/freeipa-master.

Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1390/head:pr1390
git checkout pr1390
From b10317dad128d44e5ba5cb5da0a9faf90f1efc00 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Tue, 12 Dec 2017 16:40:44 +0100
Subject: [PATCH] Require python-ldap 3.0.0b2

Use new LDAPBytesWarning to ignore python-ldap's bytes warnings. New
build is available in @freeipa/freeipa-master.

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 freeipa.spec.in      |  2 +-
 ipapython/ipaldap.py | 10 ++--------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 7c523867f9..148131bccc 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -59,7 +59,7 @@
 %global samba_version 2:4.7.0
 %global selinux_policy_version 3.13.1-158.4
 %global slapi_nis_version 0.56.1
-%global python_ldap_version 3.0.0
+%global python_ldap_version 3.0.0-0.2.b2
 %endif
 
 
diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py
index 3255fc1d71..44210a1d30 100644
--- a/ipapython/ipaldap.py
+++ b/ipapython/ipaldap.py
@@ -77,17 +77,11 @@
 DIRMAN_DN = DN(('cn', 'directory manager'))
 
 
-if six.PY2:
+if six.PY2 and hasattr(ldap, 'LDAPBytesWarning'):
     # XXX silence python-ldap's BytesWarnings
     warnings.filterwarnings(
         action="ignore",
-        message="Under Python 2, python-ldap uses bytes",
-        category=BytesWarning
-    )
-    warnings.filterwarnings(
-        action="ignore",
-        message="Received non-bytes value",
-        category=BytesWarning
+        category=ldap.LDAPBytesWarning,  # pylint: disable=no-member
     )
 
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to