mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
use query functions in project backpack
This commit is contained in:
parent
cb62b17571
commit
7416508e80
1 changed files with 8 additions and 7 deletions
|
|
@ -24,7 +24,10 @@ from bson.json_util import (
|
|||
dumps,
|
||||
CANONICAL_JSON_OPTIONS
|
||||
)
|
||||
|
||||
from openpype.client import (
|
||||
get_project,
|
||||
get_whole_project,
|
||||
)
|
||||
from openpype.pipeline import AvalonMongoDB
|
||||
|
||||
DOCUMENTS_FILE_NAME = "database"
|
||||
|
|
@ -55,9 +58,7 @@ def pack_project(project_name, destination_dir=None):
|
|||
"""
|
||||
print("Creating package of project \"{}\"".format(project_name))
|
||||
# Validate existence of project
|
||||
dbcon = AvalonMongoDB()
|
||||
dbcon.Session["AVALON_PROJECT"] = project_name
|
||||
project_doc = dbcon.find_one({"type": "project"})
|
||||
project_doc = get_project(project_name)
|
||||
if not project_doc:
|
||||
raise ValueError("Project \"{}\" was not found in database".format(
|
||||
project_name
|
||||
|
|
@ -118,7 +119,7 @@ def pack_project(project_name, destination_dir=None):
|
|||
temp_docs_json = s.name
|
||||
|
||||
# Query all project documents and store them to temp json
|
||||
docs = list(dbcon.find({}))
|
||||
docs = list(get_whole_project(project_name))
|
||||
data = dumps(
|
||||
docs, json_options=CANONICAL_JSON_OPTIONS
|
||||
)
|
||||
|
|
@ -147,7 +148,7 @@ def pack_project(project_name, destination_dir=None):
|
|||
# Cleanup
|
||||
os.remove(temp_docs_json)
|
||||
os.remove(temp_metadata_json)
|
||||
dbcon.uninstall()
|
||||
|
||||
print("*** Packing finished ***")
|
||||
|
||||
|
||||
|
|
@ -207,7 +208,7 @@ def unpack_project(path_to_zip, new_root=None):
|
|||
print("Using different root path {}".format(new_root))
|
||||
root_path = new_root
|
||||
|
||||
project_doc = collection.find_one({"type": "project"})
|
||||
project_doc = get_project(project_name)
|
||||
roots = project_doc["config"]["roots"]
|
||||
key = tuple(roots.keys())[0]
|
||||
update_key = "config.roots.{}.{}".format(key, low_platform)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue