From 294282c7caa597fd28ed3711204a1c4583d7a7a2 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Tue, 14 Mar 2023 18:40:53 +0530 Subject: [PATCH] Fixed circular import error. --- web/pgadmin/utils/paths.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/utils/paths.py b/web/pgadmin/utils/paths.py index a95f5ca96..3a5ad7ece 100644 --- a/web/pgadmin/utils/paths.py +++ b/web/pgadmin/utils/paths.py @@ -10,7 +10,7 @@ """This file contains functions fetching different utility paths.""" import os -import config + from flask import current_app, url_for from flask_security import current_user from werkzeug.exceptions import InternalServerError @@ -31,6 +31,9 @@ def preprocess_username(un): def get_storage_directory(user=current_user, shared_storage=''): + # Don't move this import statement to the top of the file, + # it throws circular import error. + import config if config.SERVER_MODE is not True: return None @@ -96,6 +99,9 @@ def get_storage_directory(user=current_user, shared_storage=''): def init_app(): + # Don't move this import statement to the top of the file, + # it throws circular import error. + import config if config.SERVER_MODE is not True: return None @@ -138,6 +144,9 @@ def create_users_storage_directory(): This function is used to iterate through all the users and create users directory if not already created. """ + # Don't move this import statement to the top of the file, + # it throws circular import error. + import config if not config.SERVER_MODE: return None