def __init__(self): # self.__dest = [DestObject(self.__counter)] # self.__tempdest = self.__dest self.dest = [DestObject(self.__counter)] self.__index = 0 self.__firstrun = True
def setdest(self, Dest=None): if not Dest: Dest = DestObject(self.__index) self.dest.append(Dest) self.__index += 1
self.setdest() returnvalue = self.dest[self.__index] return returnvalue else: self.__index = 0 return self.dest[self.__index] except IndexError: self.__index = 0 return self.dest[self.__index] def setdest(self, Dest=None): if not Dest: Dest = DestObject(self.__index) self.dest.append(Dest) self.__index += 1 if __name__ == "__main__": from FreeTAKServer.controllers.XMLCoTController import XMLCoTController from lxml import etree a = Marti.other() b = etree.fromstring(b'<marti><dest callsign = "bbbb"/></marti>') x = XMLCoTController().serialize_CoT_to_model(a, b) y = x.getdest().callsign print(a.__dict__) M = DestObject() M.setcallsign('13243432w') a.setdest(M) for x in a.dest: f = a.getdest() print('done')