Add equals operator overload
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
from Messaging.packmessage import PackMessage
|
from Messaging.packmessage import PackMessage
|
||||||
|
|
||||||
class Vote(PackMessage):
|
class Vote(PackMessage):
|
||||||
def __init__(self, voter, vote):
|
def __init__(self, vote = None):
|
||||||
self._vote = vote
|
self._vote = vote
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -12,6 +12,13 @@ class Vote(PackMessage):
|
|||||||
def vote(self, value):
|
def vote(self, value):
|
||||||
self._vote = 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):
|
def serialise(self):
|
||||||
|
|
||||||
# Still need associated device as well? to know who went the message,
|
# Still need associated device as well? to know who went the message,
|
||||||
|
|||||||
Reference in New Issue
Block a user