Corrected inconsistent property, getter and setter use. Fixed #16.

This commit is contained in:
Mark Qvist 2024-01-16 13:26:33 +01:00
parent 7a1bcc134b
commit f0e9fa6659

View File

@ -170,6 +170,17 @@ class LXMessage:
def get_fields(self): def get_fields(self):
return self.fields return self.fields
@property
def destination(self):
return self.__destination
@destination.setter
def destination(self, destination):
self.set_destination(destination)
def get_destination(self):
return self.destination
def set_destination(self, destination): def set_destination(self, destination):
if self.destination == None: if self.destination == None:
if isinstance(destination, RNS.Destination): if isinstance(destination, RNS.Destination):
@ -179,8 +190,16 @@ class LXMessage:
else: else:
raise ValueError("Cannot reassign destination on LXMessage") raise ValueError("Cannot reassign destination on LXMessage")
def get_destination(self): @property
return self.__destination def source(self):
return self.__source
@source.setter
def source(self, source):
self.set_source(source)
def get_source(self):
return self.source
def set_source(self, source): def set_source(self, source):
if self.source == None: if self.source == None:
@ -191,9 +210,6 @@ class LXMessage:
else: else:
raise ValueError("Cannot reassign source on LXMessage") raise ValueError("Cannot reassign source on LXMessage")
def get_source(self):
return self.__source
def set_delivery_destination(self, delivery_destination): def set_delivery_destination(self, delivery_destination):
self.__delivery_destination = delivery_destination self.__delivery_destination = delivery_destination