Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions doc/reference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
The return value of <function>search()</function> is a list of 2-tuples.
Each tuple consists of a distinguished name and a dictionary of attributes.
The dictionary has string keys (the attribute names) and a list of strings
as it values (the attribute values).
or bytes as it values (the attribute values).
</para>

<programlisting>
Expand All @@ -360,9 +360,9 @@
attribute to be added. The parameter <parameter>attrs</parameter> specifies
the attributes of the object. It must be a list of 2-tuples, with the first
tuple entry the attribute name, and the second tuple entry a list of strings
containing the attribute values. The <parameter>server</parameter> parameter
can be used to override the default binding behaviour and has the same
meaning as for <function>search()</function>.
or bytes containing the attribute values. The <parameter>server</parameter>
parameter can be used to override the default binding behaviour and has the
same meaning as for <function>search()</function>.
</para>

<programlisting>
Expand All @@ -380,8 +380,8 @@
or delete an attribute value respectively -- the Python-LDAP
<literal>MOD_*</literal> constants are supported for compatibility), the
attribute name, and the attribute value. The latter must be a list of
strings. The <parameter>server</parameter> parameter can be used to override
the default binding behaviour and has the same meaning as for
strings or bytes. The <parameter>server</parameter> parameter can be used
to override the default binding behaviour and has the same meaning as for
<function>search()</function>.
</para>

Expand Down
22 changes: 11 additions & 11 deletions lib/activedirectory/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@ def _fixup_attrs(self, attrs):
pass
elif isinstance(attrs, list) or isinstance(attrs, tuple):
for item in attrs:
if not isinstance(item, str):
raise TypeError('Expecting sequence of strings.')
if not isinstance(item, str) and not isinstance(item, bytes):
raise TypeError('Expecting sequence of strings or bytes.')
else:
raise TypeError('Expecting sequence of strings.')
raise TypeError('Expecting sequence of strings or bytes.')
return attrs

def _search_with_paged_results(self, conn, filter, base, scope, attrs):
Expand Down Expand Up @@ -429,12 +429,12 @@ def _fixup_add_list(self, attrs):
raise TypeError('Expecting list of 2-tuples.')
for type,values in attrs:
if not isinstance(type, str):
raise TypeError('List items must be 2-tuple of (str, [str]).')
raise TypeError('List items must be 2-tuple of (str, [str|bytes]).')
if not isinstance(values, list) and not isinstance(values, tuple):
raise TypeError('List items must be 2-tuple of (str, [str]).')
raise TypeError('List items must be 2-tuple of (str, [str|bytes]).')
for val in values:
if not isinstance(val, str):
raise TypeError('List items must be 2-tuple of (str, [str]).')
if not isinstance(val, str) and not isinstance(val, bytes):
raise TypeError('List items must be 2-tuple of (str, [str|bytes]).')
return attrs

def add(self, dn, attrs, server=None):
Expand Down Expand Up @@ -474,12 +474,12 @@ def _fixup_modify_list(self, mods):
for op,type,values in mods:
op = self._fixup_modify_operation(op)
if not isinstance(type, str):
raise TypeError('List items must be 3-tuple of (str, str, [str]).')
raise TypeError('List items must be 3-tuple of (str, str, [str|bytes]).')
if not isinstance(values, list) and not isinstance(values, tuple):
raise TypeError('List items must be 3-tuple of (str, str, [str]).')
raise TypeError('List items must be 3-tuple of (str, str, [str|bytes]).')
for val in values:
if not isinstance(val, str):
raise TypeError('List item must be 3-tuple of (str, str, [str]).')
if not isinstance(val, str) and not isinstance(val, bytes):
raise TypeError('List item must be 3-tuple of (str, str, [str|bytes]).')
result.append((op,type,values))
return result

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name='python-active-directory',
version='2.0.0',
version='2.0.1',
description='An Active Directory client library for Python',
long_description=open('README.rst').read(),
long_description_content_type='text/x-rst',
Expand Down