File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88import datetime
99import json
10+ import sys
1011import yaml
1112
1213from . import xmlparser
1718from .rdf_converter import RDFReader , RDFWriter
1819from ..validation import Validation
1920
21+ try :
22+ unicode = unicode
23+ except NameError :
24+ unicode = str
25+
2026
2127class ODMLWriter :
2228 """
@@ -58,7 +64,7 @@ def to_string(self, odml_document):
5864 string_doc = ''
5965
6066 if self .parser == 'XML' :
61- string_doc = str (xmlparser .XMLWriter (odml_document ))
67+ string_doc = unicode (xmlparser .XMLWriter (odml_document ))
6268 elif self .parser == "RDF" :
6369 # Use turtle as default output format for now.
6470 string_doc = RDFWriter (odml_document ).get_rdf_str ("turtle" )
@@ -74,6 +80,9 @@ def to_string(self, odml_document):
7480 string_doc = json .dumps (odml_output , indent = 4 ,
7581 cls = JSONDateTimeSerializer )
7682
83+ if sys .version_info .major < 3 :
84+ string_doc = string_doc .encode ("utf-8" )
85+
7786 return string_doc
7887
7988
You can’t perform that action at this time.
0 commit comments