From 2397867d28071ea12734588e993c3a7f94c04914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 1 Jun 2023 17:13:35 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20treating=20of=20`None`=20s?= =?UTF-8?q?orting=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `None` values were converted to an empty string by sv, leading to comparison issues with (correct) integers. Using the default order value for sv fixes that. Closes #4818 --- src/octoprint/plugin/core.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/octoprint/plugin/core.py b/src/octoprint/plugin/core.py index ad66d87a2..297386e4a 100644 --- a/src/octoprint/plugin/core.py +++ b/src/octoprint/plugin/core.py @@ -577,7 +577,9 @@ class PluginInfo: self._version if self._version is not None else self._get_instance_attribute( - ControlProperties.attr_version, default=self._version, incl_metadata=True + ControlProperties.attr_version, + default=self._version, + incl_metadata=True, ) ) @@ -959,7 +961,9 @@ class PluginManager: if self.plugin_folders: try: added, found = self._find_plugins_from_folders( - self.plugin_folders, existing, ignored_uninstalled=ignore_uninstalled + self.plugin_folders, + existing, + ignored_uninstalled=ignore_uninstalled, ) result_added.update(added) result_found += found @@ -1791,7 +1795,10 @@ class PluginManager: plugin_hooks = plugin.hooks.keys() return any( - map(lambda hook: PluginManager.hook_matches_hooks(hook, *hooks), plugin_hooks) + map( + lambda hook: PluginManager.hook_matches_hooks(hook, *hooks), + plugin_hooks, + ) ) @staticmethod @@ -2168,7 +2175,7 @@ class PluginManager: plugin_info = self.get_plugin_info(impl[0], require_enabled=False) return ( - sv(sorting_value), + sv(sorting_value, default_value=self.default_order), not plugin_info.bundled if plugin_info else True, sv(impl[0]), )