Browse Source

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
Marek Marczykowski-Górecki 7 years ago
parent
commit
3e0f225938
1 changed files with 2 additions and 0 deletions
  1. 2 0
      qubes/__init__.py

+ 2 - 0
qubes/__init__.py

@@ -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__