FEM: fix unicode conversion error (sifio.py)

The sifio module could only serialize the str type. This commits
adds support for unicode strings. Some properties of FreeCAD
objects like the equation variable name use unicode strings.
This commit is contained in:
Markus Hovorka
2018-02-10 11:34:22 +01:00
committed by Yorik van Havre
parent cfde8a0d51
commit c110f04823

View File

@@ -394,12 +394,14 @@ class _Writer(object):
return _TYPE_REAL
if issubclass(dataType, str):
return _TYPE_STRING
if issubclass(dataType, unicode):
return _TYPE_STRING
raise ValueError("Unsupported data type: %s" % dataType)
def _preprocess(self, data, dataType):
if issubclass(dataType, Section):
return str(self._idMgr.getId(data))
if issubclass(dataType, str):
if issubclass(dataType, str) or issubclass(dataType, unicode):
return '"%s"' % data
return str(data)