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

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