From b7b599907902d0a71fac643c7ab604d5a4c8dc1e Mon Sep 17 00:00:00 2001 From: stroeder Date: Sun, 24 Jul 2016 15:58:26 +0000 Subject: [PATCH] is_dn() now also accepts flags and passes it to str2dn() --- Lib/ldap/dn.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/ldap/dn.py b/Lib/ldap/dn.py index 45950e5..569b296 100644 --- a/Lib/ldap/dn.py +++ b/Lib/ldap/dn.py @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -\$Id: dn.py,v 1.15 2016/07/24 15:43:03 stroeder Exp $ +\$Id: dn.py,v 1.16 2016/07/24 15:58:26 stroeder Exp $ Compability: - Tested with Python 2.0+ @@ -110,14 +110,14 @@ def explode_rdn(rdn,notypes=0,flags=0): return ['='.join((atype,escape_dn_chars(avalue or ''))) for atype,avalue,dummy in rdn_decomp] -def is_dn(s): +def is_dn(s,flags=0): """ Returns True is `s' can be parsed by ldap.dn.str2dn() like as a distinguished host_name (DN), otherwise False is returned. """ try: - str2dn(s) - except Exception, err: + str2dn(s,flags) + except Exception: return False else: return True