Commits

Yuriy Netesov committed d172bf4 Draft

[erlang::json] module name fix

  • Participants
  • Parent commits 2ad29e4

Comments (0)

Files changed (1)

generators/erlang/templates/json/serialization.py

 from protogen.generators.templates.template import Template, TSimple
 from protogen.generators.erlang.templates.json.serializers import MessageSerializers
 from protogen.generators.erlang.templates.json.deserializers import MessageDeserializers
+from string import Template as StringTemplate
 
 class MessagesSerialization(Template):
     def __init__(self, protocol):
         self._protocol = protocol
 
     def body(self):
-        self.add(TSimple("-module(json_messaging)."))
-        self.add(TSimple('-include("messaging.hrl").'))
+        protocolName = self._protocol.get_name()
+        self.add(TSimple(StringTemplate("-module(${protocolName}_json_messaging).").substitute(locals())))
+        self.add(TSimple('-include("${protocol_name}_messaging.hrl").'))
         self.add(TSimple("-export([serialize_message/1, deserialize_message/1]).")) 
         self.add(MessageSerializers(self._protocol))
         self.add(MessageDeserializers(self._protocol))