Hi, I have a C++ based service that uses messages defined like so....

[code]
message RPCMessage {
    required string rpcname = 1;
    extensions 100 to max;
}
[/code]


[code]


message CustomRPCMessage  {

    message Response {
        required String id = 1;
        required int version = 2;
        repeated String data = 3;
    }

    extend RPCMessage {
        repeated Response response = 100;
    }
}
[/code]

I want to write a python based script to act as a dummy server for
testing my client.

In C++ I can write:

CustomRPCMessage::Response* response =
message.AddExtension(CustomRPCMessage::response);
response->set_id("My ID");
response->set_version(10);
....


I've been trying to do the same in python, but can't seem to figure
out how to do it.  The AddExtension method doesn't seem to be
available.  Can anyone point me in the right direction?  Cheers?


At the moment I have....
[code]
import CustomMessages_pb2
import RPCMessage_pb2

message = RPCMessage_pb2.RPCMessage()
message.rpcName = 'MyCustomMessage'

message.AddExtension(CustomMessages_pb2.CustomRPCMessage.response)

print 'do something here'
[/code]

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to