diff --git a/openpype/modules/shotgrid/hooks/post_shotgrid_changes.py b/openpype/modules/shotgrid/hooks/post_shotgrid_changes.py deleted file mode 100644 index e8369ad3cb..0000000000 --- a/openpype/modules/shotgrid/hooks/post_shotgrid_changes.py +++ /dev/null @@ -1,9 +0,0 @@ -from openpype.lib import PostLaunchHook - - -class PostShotgridHook(PostLaunchHook): - order = None - - def execute(self, *args, **kwargs): - print(args, kwargs) - pass diff --git a/openpype/modules/shotgrid/lib/settings.py b/openpype/modules/shotgrid/lib/settings.py index 4a772de5b7..924099f04b 100644 --- a/openpype/modules/shotgrid/lib/settings.py +++ b/openpype/modules/shotgrid/lib/settings.py @@ -1,24 +1,11 @@ -import os - -from pymongo import MongoClient from openpype.api import get_system_settings, get_project_settings from openpype.modules.shotgrid.lib.const import MODULE_NAME -from openpype.modules.shotgrid.lib.tools import memoize -def get_project_list(): - mongo_url = os.getenv("OPENPYPE_MONGO") - client = MongoClient(mongo_url) - db = client['avalon'] - return db.list_collection_names() - - -@memoize def get_shotgrid_project_settings(project): return get_project_settings(project).get(MODULE_NAME, {}) -@memoize def get_shotgrid_settings(): return get_system_settings().get("modules", {}).get(MODULE_NAME, {}) @@ -29,13 +16,3 @@ def get_shotgrid_servers(): def get_leecher_backend_url(): return get_shotgrid_settings().get("leecher_backend_url") - - -def filter_projects_by_login(): - return bool(get_shotgrid_settings().get("filter_projects_by_login", False)) - - -def get_shotgrid_event_mongo_info(): - database_name = os.environ["OPENPYPE_DATABASE_NAME"] - collection_name = "shotgrid_events" - return database_name, collection_name diff --git a/openpype/modules/shotgrid/plugins/publish/collect_shotgrid_entities.py b/openpype/modules/shotgrid/plugins/publish/collect_shotgrid_entities.py index a770c1eb87..9880425a41 100644 --- a/openpype/modules/shotgrid/plugins/publish/collect_shotgrid_entities.py +++ b/openpype/modules/shotgrid/plugins/publish/collect_shotgrid_entities.py @@ -1,7 +1,7 @@ import os import pyblish.api -from pymongo import MongoClient +from openpype.lib.mongo import OpenPypeMongoConnection from openpype.modules.shotgrid.lib.settings import ( get_shotgrid_project_settings, @@ -63,8 +63,7 @@ class CollectShotgridEntities(pyblish.api.ContextPlugin): def _get_shotgrid_collection(project): - mongo_url = os.getenv("OPENPYPE_MONGO") - client = MongoClient(mongo_url) + client = OpenPypeMongoConnection.get_mongo_client() return client.get_database("shotgrid_openpype").get_collection(project)