qubes: allow 'property' object comparing with str

This will allow checking if a given name is valid property name, using
simple `name in vm.property_list()`.

QubesOS/qubes-issues#853
This commit is contained in:
Marek Marczykowski-Górecki 2017-02-27 21:57:56 +01:00
parent 2169075807
commit 3e0f225938
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -306,6 +306,8 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
return NotImplemented
def __eq__(self, other):
if isinstance(other, str):
return self.__name__ == other
return isinstance(other, property) and self.__name__ == other.__name__