From 983bf24d350f511069825844ec5584b50ce07a3e Mon Sep 17 00:00:00 2001 From: stroeder Date: Sat, 8 Aug 2015 13:37:41 +0000 Subject: [PATCH] LDAPObject.read_s() now returns None instead of raising ldap.NO_SUCH_OBJECT in case the search operation returned emtpy result. --- CHANGES | 4 +++- Lib/ldap/ldapobject.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 76830ab..9d03e6c 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,8 @@ Released 2.4.21 2015-07-xx Changes since 2.4.20: Lib/ +* LDAPObject.read_s() now returns None instead of raising + ldap.NO_SUCH_OBJECT in case the search operation returned emtpy result. ---------------------------------------------------------------- Released 2.4.20 2015-07-07 @@ -1185,4 +1187,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.351 2015/08/08 13:36:30 stroeder Exp $ +$Id: CHANGES,v 1.352 2015/08/08 13:37:41 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index f29d316..c807973 100644 --- a/Lib/ldap/ldapobject.py +++ b/Lib/ldap/ldapobject.py @@ -3,7 +3,7 @@ ldapobject.py - wraps class _ldap.LDAPObject See http://www.python-ldap.org/ for details. -\$Id: ldapobject.py,v 1.146 2015/06/11 15:13:43 stroeder Exp $ +\$Id: ldapobject.py,v 1.147 2015/08/08 13:37:41 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -695,7 +695,7 @@ class SimpleLDAPObject: if r: return r[0][1] else: - raise ldap.NO_SUCH_OBJECT('Empty search result reading entry %s' % (repr(dn))) + return None def read_subschemasubentry_s(self,subschemasubentry_dn,attrs=None): """