From 3e0f22593805ccc3321073f1507c04a1d2af16eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 27 Feb 2017 21:57:56 +0100 Subject: [PATCH] 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 --- qubes/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qubes/__init__.py b/qubes/__init__.py index ff56dd91..697605ce 100644 --- a/qubes/__init__.py +++ b/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__