Blame SOURCES/virt-manager-console-fix-error-with-old-pygobject.patch

f9bf59
From 61e24e595852a552019912b9a9d6884f5012dc6e Mon Sep 17 00:00:00 2001
f9bf59
From: Pavel Hrdina <phrdina@redhat.com>
f9bf59
Date: Fri, 5 Feb 2021 12:15:46 +0100
f9bf59
Subject: [PATCH] console: fix error with old pygobject
f9bf59
f9bf59
The code doesn't work as expected. From python documentation:
f9bf59
f9bf59
    x and y
f9bf59
f9bf59
is the same as
f9bf59
f9bf59
    x if not x or y
f9bf59
f9bf59
so in the code if for some reasone `dev` is None the value stored in
f9bf59
`sensitive` will be None as well.
f9bf59
f9bf59
No the code itself works with pygobject >= 3.31.3 where they allowed
f9bf59
None as a valid boolean value, but with older versions it will fail
f9bf59
with this error message:
f9bf59
f9bf59
    TypeError: Argument 1 does not allow None as a value
f9bf59
f9bf59
Resolves: https://github.com/virt-manager/virt-manager/issues/226
f9bf59
f9bf59
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
f9bf59
(cherry picked from commit cf93e2dbff28fe05d6d45364c579f923b157beb1)
f9bf59
f9bf59
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2026987
f9bf59
f9bf59
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
f9bf59
---
f9bf59
 virtManager/details/console.py | 2 +-
f9bf59
 1 file changed, 1 insertion(+), 1 deletion(-)
f9bf59
f9bf59
diff --git a/virtManager/details/console.py b/virtManager/details/console.py
f9bf59
index c4ed478ed..18f9ddd91 100644
f9bf59
--- a/virtManager/details/console.py
f9bf59
+++ b/virtManager/details/console.py
f9bf59
@@ -258,7 +258,7 @@ class _ConsoleMenu:
f9bf59
 
f9bf59
             cb = toggled_cb
f9bf59
             cbdata = dev
f9bf59
-            sensitive = dev and not tooltip
f9bf59
+            sensitive = bool(dev and not tooltip)
f9bf59
 
f9bf59
             active = False
f9bf59
             if oldlabel is None and sensitive:
f9bf59
-- 
f9bf59
2.35.1
f9bf59