All of my properties get saved as type unicode in the xml, when the
type in the xml should be bool (but it happens with ints and floats as
well) because:
_python_to_xml = {
str: unicode,
unicode: unicode,
int: repr,
float: repr,
bool: repr,
}
_as_xml (in map and cell)
for k in self.properties:
v = self.properties[k]
v = _python_to_xml[type(v)](v) # XXX v is now unicode, or repr of
bool, int, float which is str
p = ElementTree.SubElement(m, 'property', name=k, value=v,
type=_xml_type[type(v)]) # XXX this will always be unicode
p.tail = '\n'
a simple fix is:
v = self.properties[k]
vs = _python_to_xml[type(v)](v)
p = ElementTree.SubElement(m, 'property', name=k, value=vs,
type=_xml_type[type(v)])
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---