mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Remove format strings to ensure compilation under old Python releases
This commit is contained in:
parent
e97205922c
commit
d37a74846a
@ -644,18 +644,18 @@ for plugin_name in PLUGINS:
|
|||||||
plugin = importlib.import_module(plugin_name)
|
plugin = importlib.import_module(plugin_name)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
f"Unable to import plugin {plugin_name}: Module not found. Check that the plugin module has been "
|
"Unable to import plugin {}: Module not found. Check that the plugin module has been installed within the "
|
||||||
f"installed within the correct Python environment."
|
"correct Python environment.".format(plugin_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Determine plugin config and add to INSTALLED_APPS.
|
# Determine plugin config and add to INSTALLED_APPS.
|
||||||
try:
|
try:
|
||||||
plugin_config = plugin.config
|
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:
|
except AttributeError:
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
f"Plugin {plugin_name} does not provide a 'config' variable. This should be defined in the plugin's "
|
"Plugin {} does not provide a 'config' variable. This should be defined in the plugin's __init__.py file "
|
||||||
f"__init__.py file and point to the PluginConfig subclass."
|
"and point to the PluginConfig subclass.".format(plugin_name)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Validate user-provided configuration settings and assign defaults
|
# Validate user-provided configuration settings and assign defaults
|
||||||
@ -670,7 +670,9 @@ for plugin_name in PLUGINS:
|
|||||||
|
|
||||||
# Apply cacheops config
|
# Apply cacheops config
|
||||||
if type(plugin_config.caching_config) is not dict:
|
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({
|
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()
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user