Skip to content
Snippets Groups Projects
Commit a24719b1 authored by Mikel's avatar Mikel
Browse files

1) Use the 'to_python2_and_3_compatible_string' function in the new import settings function

2) Use 'format' instead of f-string for compatibility with Python 2
parent 110e5f0e
No related branches found
No related tags found
No related merge requests found
import requests, json, re import requests, json, re
import importlib import importlib
from commons import log_response from commons import log_response, to_python2_and_3_compatible_string
def import_grafana_settings(settings_file_name): def import_grafana_settings(settings_file_name):
# On import, load the correct grafana settings from the 'conf' module/directory # On import, load the correct grafana settings from the 'conf' module/directory
conf_module_name = "conf" conf_module_name = "conf"
mdl = importlib.import_module(f"{conf_module_name}.{settings_file_name}") mdl = importlib.import_module('{0}.{1}'.format(to_python2_and_3_compatible_string(str(conf_module_name)),
to_python2_and_3_compatible_string(str(settings_file_name))))
# is there an __all__? if so respect it # is there an __all__? if so respect it
if "__all__" in mdl.__dict__: if "__all__" in mdl.__dict__:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment