Merge pull request #24 from encukou/py3-schemaelement

[Py3] schema: Decode schema elements to str when loading
This commit is contained in:
Petr Viktorin
2015-10-13 15:00:43 +02:00

View File

@@ -33,6 +33,7 @@ class SchemaElement:
schema_element_str schema_element_str
String which contains the schema element description to be parsed. String which contains the schema element description to be parsed.
(Bytestrings are decoded using UTF-8)
Class attributes: Class attributes:
@@ -47,6 +48,8 @@ class SchemaElement:
} }
def __init__(self,schema_element_str=None): 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: if schema_element_str:
l = split_tokens(schema_element_str,self.token_defaults) l = split_tokens(schema_element_str,self.token_defaults)
self.set_id(l[1]) self.set_id(l[1])