__hash__ and __eq__ for OctoPrintPermission

This commit is contained in:
Gina Häußge committed 2017-11-22 15:31:17 +01:00
1 parent fa5619fad7
commit 21c8bd54f5
1 file changed
+6
+6
View File
@@ -86,6 +86,12 @@ class OctoPrintPermission(Permission):
return '{}("{}", "{}", {})'.format(self.__class__.__name__, self.get_name(), self.get_description(), ', '.join(needs))
def __hash__(self):
return self.get_name()
def __eq__(self, other):
return isinstance(other, OctoPrintPermission) and other.get_name() == self.get_name()
class CombinedOctoPrintPermission(OctoPrintPermission):