def SerializeBody(self): # create a buffer data = cStringIO.StringIO() # calculate the login screen flags flags = 0 if self.RegistrationDisabled: flags |= self.Flag_NoRegister BinaryStructs.SerializeUint8(data, flags) # store the other fields try: BinaryStructs.SerializeUTF8(data, self.ServerName) BinaryStructs.SerializeUTF8(data, self.ServerNewsURL) except: raise IncompletePacket # return the packet retval = data.getvalue() data.close() return retval
def SerializeBody(self): # All we have to do is write the rejection code... data = cStringIO.StringIO() BinaryStructs.SerializeUint8(data, self.RejectionCode)