Exemplo n.º 1
0
 def _search(self, search_filter=None, retrieve_attributes=None,
         base=None, scope=libldap.LDAP_SCOPE_SUBTREE,
         retrieve_operational_attributes=False):
     """Search without retry_reconnect."""
     try:
         raw_search_result = self._raw_search(search_filter=search_filter,
                                              retrieve_attributes=retrieve_attributes,
                                              base=base,scope=scope,
                                              retrieve_operational_attributes=retrieve_operational_attributes)
         for dn, attributes_dict in raw_search_result:
             entry = LDAPEntry(self, compat._decode_utf8(dn),
                               retrieve_attributes=retrieve_attributes,
                               retrieve_operational_attributes=retrieve_operational_attributes)
             entry._attributes = set()
             for name, value in attributes_dict.items():
                 # TODO: Create the right type of LDAPAttribute here
                 attribute_type = self.get_attribute_type(
                         compat._decode_utf8(name))
                 attribute = attribute_type(compat._decode_utf8(name))
                 attribute._set_ldap_values(value)
                 entry._attributes.add(attribute)
             entry._fetched_attributes = copy.deepcopy(entry._attributes)
             yield entry
     except error.LDAPNoSuchObjectError:
         # If the search returned without results, "return" an empty generator.
         return
Exemplo n.º 2
0
 def _search(self, search_filter=None, retrieve_attributes=None,
         base=None, scope=libldap.LDAP_SCOPE_SUBTREE,
         retrieve_operational_attributes=False):
     """Search without retry_reconnect."""
     try:
         raw_search_result = self._raw_search(search_filter=search_filter,
                                              retrieve_attributes=retrieve_attributes,
                                              base=base,scope=scope,
                                              retrieve_operational_attributes=retrieve_operational_attributes)
         for dn, attributes_dict in raw_search_result:
             entry = LDAPEntry(self, compat._decode_utf8(dn),
                               retrieve_attributes=retrieve_attributes,
                               retrieve_operational_attributes=retrieve_operational_attributes)
             entry._attributes = set()
             for name, value in attributes_dict.items():
                 # TODO: Create the right type of LDAPAttribute here
                 attribute_type = self.get_attribute_type(
                         compat._decode_utf8(name))
                 attribute = attribute_type(compat._decode_utf8(name))
                 attribute._set_ldap_values(value)
                 entry._attributes.add(attribute)
             entry._fetched_attributes = copy.deepcopy(entry._attributes)
             yield entry
     except error.LDAPNoSuchObjectError:
         # If the search returned without results, "return" an empty generator.
         return
Exemplo n.º 3
0
 def _search(self, *args, **kwargs):
     """Search without retry_reconnect."""
     try:
         for dn, attributes_dict in self._raw_search(*args, **kwargs):
             entry = LDAPEntry(self, compat._decode_utf8(dn))
             entry._attributes = set()
             for name, value in attributes_dict.items():
                 # TODO: Create the right type of LDAPAttribute here
                 attribute_type = self.get_attribute_type(
                         compat._decode_utf8(name))
                 attribute = attribute_type(compat._decode_utf8(name))
                 attribute._set_ldap_values(value)
                 entry._attributes.add(attribute)
             entry._fetched_attributes = copy.deepcopy(entry._attributes)
             yield entry
     except error.LDAPNoSuchObjectError:
         # If the search returned without results, "return" an empty generator.
         return