Commits

Yuriy Netesov  committed 57d0440 Draft

python proto

  • Participants
  • Parent commits 8485ee9

Comments (0)

Files changed (1)

File common/protocol/tools/generators/python.xslt

 
 
 <xsl:template match="field[@type='list']" mode="serialize">
-        fields.append("\"<xsl:value-of select="@name"/>\" :" + "[" + ",".join([str(field) for field in self.<xsl:value-of select="@name"/>]) + "]")
+        fields.append("\"<xsl:value-of select="@name"/>\" :" + "[" + ",".join(["\"%s\"" % field for field in self.<xsl:value-of select="@name"/>]) + "]")
 </xsl:template>
 
 <xsl:template match="field[@type='message']" mode="serialize">
 </xsl:template>
 
 <!-- field deserialization -->
-<xsl:template match="field" mode="deserialize">
-  <xsl:value-of select="@name"/> = loadedJson["<xsl:value-of select="@name"/>"]
+<xsl:template match="field[@type='int']" mode="deserialize">
+  <xsl:value-of select="@name"/> = int(loadedJson["<xsl:value-of select="@name"/>"])
+</xsl:template>
+
+<xsl:template match="field[@type='float']" mode="deserialize">
+  <xsl:value-of select="@name"/> = float(loadedJson["<xsl:value-of select="@name"/>"])
+</xsl:template>
+
+<xsl:template match="field[@type='string']" mode="deserialize">
+  <xsl:value-of select="@name"/> = str(loadedJson["<xsl:value-of select="@name"/>"])
 </xsl:template>
 
 <xsl:template match="field[@type='message']" mode="deserialize">