Commit c1d77c04d5a2dd5efe129228e596d2932366e465
1 parent
1ad85a23
Exists in
master
and in
17 other branches
Fixing plugins path
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com> Signed-off-by: Sergio Oliveira <sergio@tracy.com.br> Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com> Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Macartur Sousa <macartur.sc@gmail.com> Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com>
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
colab/utils/conf.py
@@ -27,9 +27,8 @@ class DatabaseUndefined(ImproperlyConfigured): | @@ -27,9 +27,8 @@ class DatabaseUndefined(ImproperlyConfigured): | ||
27 | 27 | ||
28 | 28 | ||
29 | def _load_py_file(py_path, path): | 29 | def _load_py_file(py_path, path): |
30 | - original_path = sys.path | ||
31 | 30 | ||
32 | - sys.path = [path] | 31 | + sys.path.insert(0, path) |
33 | try: | 32 | try: |
34 | py_settings = importlib.import_module(py_path) | 33 | py_settings = importlib.import_module(py_path) |
35 | 34 | ||
@@ -44,7 +43,10 @@ def _load_py_file(py_path, path): | @@ -44,7 +43,10 @@ def _load_py_file(py_path, path): | ||
44 | raise InaccessibleSettings(msg) | 43 | raise InaccessibleSettings(msg) |
45 | 44 | ||
46 | finally: | 45 | finally: |
47 | - sys.path = original_path | 46 | + # We did not catch the ValueError on purpose |
47 | + # If the imported module change the path | ||
48 | + # we want to raise ValueError | ||
49 | + sys.path.remove(path) | ||
48 | 50 | ||
49 | py_setting = {var: getattr(py_settings, var) for var in dir(py_settings) | 51 | py_setting = {var: getattr(py_settings, var) for var in dir(py_settings) |
50 | if not var.startswith('__')} | 52 | if not var.startswith('__')} |