From d37a74846a6a424faf66cd7ac4d2b949a539a698 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 13 Apr 2020 14:07:44 -0400 Subject: [PATCH] Remove format strings to ensure compilation under old Python releases --- netbox/netbox/settings.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 7d2bdd2ad..ea3852711 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -644,18 +644,18 @@ for plugin_name in PLUGINS: plugin = importlib.import_module(plugin_name) except ImportError: raise ImproperlyConfigured( - f"Unable to import plugin {plugin_name}: Module not found. Check that the plugin module has been " - f"installed within the correct Python environment." + "Unable to import plugin {}: Module not found. Check that the plugin module has been installed within the " + "correct Python environment.".format(plugin_name) ) # Determine plugin config and add to INSTALLED_APPS. try: plugin_config = plugin.config - INSTALLED_APPS.append(f"{plugin_config.__module__}.{plugin_config.__name__}") + INSTALLED_APPS.append("{}.{}".format(plugin_config.__module__, plugin_config.__name__)) except AttributeError: raise ImproperlyConfigured( - f"Plugin {plugin_name} does not provide a 'config' variable. This should be defined in the plugin's " - f"__init__.py file and point to the PluginConfig subclass." + "Plugin {} does not provide a 'config' variable. This should be defined in the plugin's __init__.py file " + "and point to the PluginConfig subclass.".format(plugin_name) ) # Validate user-provided configuration settings and assign defaults @@ -670,7 +670,9 @@ for plugin_name in PLUGINS: # Apply cacheops config if type(plugin_config.caching_config) is not dict: - raise ImproperlyConfigured(f"Plugin {plugin_name} caching_config must be a dictionary.") + raise ImproperlyConfigured( + "Plugin {} caching_config must be a dictionary.".format(plugin_name) + ) CACHEOPS.update({ - f"{plugin_name}.{key}": value for key, value in plugin_config.caching_config.items() + "{}.{}".format(plugin_name, key): value for key, value in plugin_config.caching_config.items() })