[protobuf] How do I use the add method on a repeating bytes field?

2010-02-25 Thread Garry
I am a new protocol buffers and python.  I have a bytes field that
repeats.  What is the proper syntax for the add then filling the
bytes.

message AlertToDevicesMessage {
required string alert = 1;
repeated bytes device_tokens = 2;
}

a2 = xxx.AlertToDevicesMessage()
a2.alert = blah blah blah

dt = a2.deviceTokens.add()
dt. or dt =

Additionally I am not sure if it is deviceTokens or device_tokens.
Please clarify for me.

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@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.



Re: [protobuf] How do I use the add method on a repeating bytes field?

2010-02-25 Thread Kenton Varda
Actually, it's append(), not add():

  a2.device_tokens.append(a byte string)

On Thu, Feb 25, 2010 at 1:55 PM, Kenton Varda ken...@google.com wrote:

 Bytes are represented using the str type.  So you do:

   a2.device_tokens.add(a byte string)

 On Thu, Feb 25, 2010 at 9:09 AM, Garry ga...@dynafocus.com wrote:

 I am a new protocol buffers and python.  I have a bytes field that
 repeats.  What is the proper syntax for the add then filling the
 bytes.

 message AlertToDevicesMessage {
required string alert = 1;
repeated bytes device_tokens = 2;
 }

 a2 = xxx.AlertToDevicesMessage()
 a2.alert = blah blah blah

 dt = a2.deviceTokens.add()
 dt. or dt =

 Additionally I am not sure if it is deviceTokens or device_tokens.
 Please clarify for me.

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




-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@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.