Procházet zdrojové kódy

Remove format strings to ensure compilation under old Python releases

Jeremy Stretch před 5 roky
rodič
revize
d37a74846a
1 změnil soubory, kde provedl 9 přidání a 7 odebrání
  1. 9 7
      netbox/netbox/settings.py

+ 9 - 7
netbox/netbox/settings.py

@@ -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 "
-            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.
     # 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 "
-            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
     # 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()
     })
     })