from Messaging.packmessage import PackMessage class Vote(PackMessage): def __init__(self, vote = None): self._vote = vote @property def vote(self): return self._vote @vote.setter def vote(self, value): self._vote = value def __eq__(self, other): if not isinstance(other, Vote): return False if other.vote == self.vote: return True def serialise(self): # Still need associated device as well? to know who went the message, # to check that we don't add too many messages in case of multiple # sends. self.message = {"vote": self.vote} # Call super method equivalent. super(Vote, self).serialise() def deserialise(self): super(Vote, self).deserialise() if "vote" in self.message: self.vote = self.message["vote"] else: # Do something. pass