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

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