deb-python-pyldap/Doc/ldap-filter.rst

1.3 KiB

:pyldap.filter LDAP filter handling

python-ldap project (see http://www.python-ldap.org/)

4515 - Lightweight Directory Access Protocol (LDAP): String Representation of Search Filters.

The ldap.filter module defines the following functions:

escape_filter_chars(assertion_value[, escape_mode=0])

This function escapes characters in assertion_value which are special in LDAP filters. You should use this function when building LDAP filter strings from arbitrary input. escape_mode means: If 0 only special chars mentioned in RFC 4515 are escaped. If 1 all NON-ASCII chars are escaped. If 2 all chars are escaped.

filter_format(filter_template, assertion_values)

This function applies escape_filter_chars to each of the strings in list assertion_values. After that filter_template containing as many %s placeholders as count of assertion values is used to build the whole filter string.