|
@ -23,19 +23,22 @@ class Group: |
|
|
else: |
|
|
else: |
|
|
self.members.append(admidio.getMemberFromID(row[0])) |
|
|
self.members.append(admidio.getMemberFromID(row[0])) |
|
|
except MemberNotFoundException: |
|
|
except MemberNotFoundException: |
|
|
print( |
|
|
|
|
|
f"Member with id {row[0]} not found, group id: {self.id}") |
|
|
|
|
|
|
|
|
print(f"Member with id {row[0]} not found, group id: {self.id}") |
|
|
|
|
|
|
|
|
def __eq__(self, other): |
|
|
def __eq__(self, other): |
|
|
if isinstance(other, Group): |
|
|
if isinstance(other, Group): |
|
|
return self.hash() == other.hash() |
|
|
return self.hash() == other.hash() |
|
|
|
|
|
|
|
|
def hash(self): |
|
|
def hash(self): |
|
|
return hashlib.md5((str(self.id) + self.name |
|
|
|
|
|
+ (''.join(str(x) for x in self.members) or '') |
|
|
|
|
|
+ (''.join(str(x) for x in self.leaders) or '') |
|
|
|
|
|
).encode('utf-8')).hexdigest() |
|
|
|
|
|
|
|
|
return hashlib.md5( |
|
|
|
|
|
( |
|
|
|
|
|
str(self.id) |
|
|
|
|
|
+ self.name |
|
|
|
|
|
+ ("".join(str(x) for x in self.members) or "") |
|
|
|
|
|
+ ("".join(str(x) for x in self.leaders) or "") |
|
|
|
|
|
).encode("utf-8") |
|
|
|
|
|
).hexdigest() |
|
|
|
|
|
|
|
|
def getAllMembers(self): |
|
|
def getAllMembers(self): |
|
|
"""Return leaders and members in group, combined""" |
|
|
"""Return leaders and members in group, combined""" |
|
|
return self.leaders.append(self.members) |
|
|
|
|
|
|
|
|
return self.leaders + self.members |