diff --git a/easyLDAP/easyLDAP_utils.py b/easyLDAP/easyLDAP_utils.py index 20ced6f3bdb2c38f93817b72cf4d981b1bdefb66..c4680555139133d720e1db2f45f05f94bb59477f 100644 --- a/easyLDAP/easyLDAP_utils.py +++ b/easyLDAP/easyLDAP_utils.py @@ -365,7 +365,7 @@ def make_pyldapobject(pyldapobject): return _rewritten_pyldapobject -def is_pyldaptree(pyldaptree): +def is_pyldaptree(pyldaptree, strict=True): """ Return C{True}, if the given data structure (several Python dictionaries in a Python list) conforms to the Python LDAP data format and all the @@ -374,14 +374,21 @@ def is_pyldaptree(pyldaptree): @param pyldaptree: the LDAP data structure to be tested for Python LDAP compliancy @type pyldaptree: list + @param strict: really check, if this is a tree-like structure + @type strict: bool + """ - # - # TODO: really check, if the DNs form something like a tree hierarchy - # - if len(pyldaptree) > 1: + if len(pyldaptree) >= 1: for dn_object in pyldaptree: - if not is_pyldapobject([dn_object], strict=False): + if not is_pyldapobject([dn_object], strict=strict): return False + + if strict: + # + # TODO: really check, if the DNs form something like a tree hierarchy + # + pass + else: return False