added option to pass global settings to 'get_expected_studio_version_str'

This commit is contained in:
iLLiCiTiT 2021-12-09 12:13:36 +01:00
parent 070078d157
commit 43c552dbbf
2 changed files with 11 additions and 4 deletions

View file

@ -187,17 +187,21 @@ def get_openpype_path_from_db(url: str) -> Union[str, None]:
return None
def get_expected_studio_version_str(staging=False) -> str:
def get_expected_studio_version_str(
staging=False, global_settings=None
) -> str:
"""Version that should be currently used in studio.
Args:
staging (bool): Get current version for staging.
global_settings (dict): Optional precached global settings.
Returns:
str: OpenPype version which should be used. Empty string means latest.
"""
mongo_url = os.environ.get("OPENPYPE_MONGO")
global_settings = get_openpype_global_settings(mongo_url)
if global_settings is None:
global_settings = get_openpype_global_settings(mongo_url)
if staging:
key = "staging_version"
else: