[gnome-tweak-tool] Fix KeyError when extensions with no version installed
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Fix KeyError when extensions with no version installed
- Date: Wed, 17 Sep 2014 17:09:02 +0000 (UTC)
commit 6c05bebbc835ca589da5e2fb114f7ce4faaa1b50
Author: Petr Kocandrle <pkocandr redhat com>
Date: Thu May 15 10:59:45 2014 +0200
Fix KeyError when extensions with no version installed
https://bugzilla.gnome.org/show_bug.cgi?id=730177
gtweak/tweaks/tweak_group_shell_extensions.py | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_shell_extensions.py b/gtweak/tweaks/tweak_group_shell_extensions.py
index d615ea9..6ce2787 100644
--- a/gtweak/tweaks/tweak_group_shell_extensions.py
+++ b/gtweak/tweaks/tweak_group_shell_extensions.py
@@ -25,10 +25,13 @@ def _fix_shell_version_for_ego(version):
version = '.'.join(version.split('.')[0:3])
if version[-1] == '0':
#if it is .0, drop that too
- return '.'.join(version.split('.')[0:2])
+ return _get_shell_major_minor_version(version)
else:
return version
+def _get_shell_major_minor_version(version):
+ return '.'.join(version.split('.')[0:2])
+
class _ShellExtensionTweak(Gtk.ListBoxRow, Tweak):
def __init__(self, shell, ext, **options):
@@ -311,14 +314,16 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
resp = resp['shell_version_map']
shell = GnomeShellFactory().get_shell()
version = _fix_shell_version_for_ego(shell.version)
- try:
+
+ if version in resp:
resp = resp[version]
- if int(resp["version"]) > extension["version"]:
+ ext_version = extension["version"] if "version" in extension else 0
+ if int(resp["version"]) > ext_version:
widget.add_update_button(uuid)
-
- except KeyError:
+ else:
+ ext_version = extension["version"] if "version" in extension else "unknown"
logging.info("e.g.o no updates for %s (shell version %s extension version %s)" % (
- uuid,version,extension["version"]))
+ uuid, version, ext_version))
def _list_header_func(self, row, before, user_data):
if before and not row.get_header():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]