[Py3] schema: Decode schema elements to str when loading

Fixes https://github.com/pyldap/pyldap/issues/11
This commit is contained in:
Petr Viktorin
2015-10-06 12:58:14 +02:00
parent 4f0400a79a
commit c85f2cc926

View File

@@ -33,6 +33,7 @@ class SchemaElement:
schema_element_str
String which contains the schema element description to be parsed.
(Bytestrings are decoded using UTF-8)
Class attributes:
@@ -47,6 +48,8 @@ class SchemaElement:
}
def __init__(self,schema_element_str=None):
if sys.version_info >= (3, 0) and isinstance(schema_element_str, bytes):
schema_element_str = schema_element_str.decode('utf-8')
if schema_element_str:
l = split_tokens(schema_element_str,self.token_defaults)
self.set_id(l[1])