From bfb0874f0399a2e67f8cb389ddea1404329cd53a Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Wed, 21 Apr 2021 13:35:04 +0200 Subject: [PATCH] renamed SaveWarning to SaveWarningExc --- openpype/modules/ftrack/ftrack_module.py | 12 +++++------ openpype/settings/__init__.py | 4 ++-- openpype/settings/entities/root_entities.py | 8 ++++---- openpype/settings/exceptions.py | 4 ++-- openpype/settings/lib.py | 20 +++++++++---------- .../settings/settings/widgets/categories.py | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/openpype/modules/ftrack/ftrack_module.py b/openpype/modules/ftrack/ftrack_module.py index 54e92af42c..60eed5c941 100644 --- a/openpype/modules/ftrack/ftrack_module.py +++ b/openpype/modules/ftrack/ftrack_module.py @@ -13,7 +13,7 @@ from openpype.modules import ( ILaunchHookPaths, ISettingsChangeListener ) -from openpype.settings import SaveWarning +from openpype.settings import SaveWarningExc FTRACK_MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -136,7 +136,7 @@ class FtrackModule( session = self.create_ftrack_session() except Exception: self.log.warning("Couldn't create ftrack session.", exc_info=True) - raise SaveWarning(( + raise SaveWarningExc(( "Couldn't create Ftrack session." " You may need to update applications" " and tools in Ftrack custom attributes using defined action." @@ -205,7 +205,7 @@ class FtrackModule( session.commit() if missing_attributes: - raise SaveWarning(( + raise SaveWarningExc(( "Couldn't find custom attribute/s ({}) to update." " You may need to update applications" " and tools in Ftrack custom attributes using defined action." @@ -234,7 +234,7 @@ class FtrackModule( session = self.create_ftrack_session() except Exception: self.log.warning("Couldn't create ftrack session.", exc_info=True) - raise SaveWarning(( + raise SaveWarningExc(( "Couldn't create Ftrack session." " You may need to update applications" " and tools in Ftrack custom attributes using defined action." @@ -250,7 +250,7 @@ class FtrackModule( " Can't push attribute changes." ).format(project_name) self.log.warning(msg) - raise SaveWarning(msg) + raise SaveWarningExc(msg) project_id = project_entity["id"] @@ -323,7 +323,7 @@ class FtrackModule( for key, value in failed.items() ]) error_msg += "\nFailed to set: {}".format(joined_failed) - raise SaveWarning(error_msg) + raise SaveWarningExc(error_msg) def create_ftrack_session(self, **session_kwargs): import ftrack_api diff --git a/openpype/settings/__init__.py b/openpype/settings/__init__.py index 78a287f07e..e65c89e603 100644 --- a/openpype/settings/__init__.py +++ b/openpype/settings/__init__.py @@ -1,5 +1,5 @@ from .exceptions import ( - SaveWarning + SaveWarningExc ) from .lib import ( get_system_settings, @@ -15,7 +15,7 @@ from .entities import ( __all__ = ( - "SaveWarning", + "SaveWarningExc", "get_system_settings", "get_project_settings", diff --git a/openpype/settings/entities/root_entities.py b/openpype/settings/entities/root_entities.py index 05c2b61700..b89473d9fb 100644 --- a/openpype/settings/entities/root_entities.py +++ b/openpype/settings/entities/root_entities.py @@ -23,7 +23,7 @@ from openpype.settings.constants import ( PROJECT_ANATOMY_KEY, KEY_REGEX ) -from openpype.settings.exceptions import SaveWarning +from openpype.settings.exceptions import SaveWarningExc from openpype.settings.lib import ( DEFAULTS_DIR, @@ -728,16 +728,16 @@ class ProjectSettings(RootEntity): warnings = [] try: save_project_settings(self.project_name, project_settings) - except SaveWarning as exc: + except SaveWarningExc as exc: warnings.extend(exc.warnings) try: save_project_anatomy(self.project_name, project_anatomy) - except SaveWarning as exc: + except SaveWarningExc as exc: warnings.extend(exc.warnings) if warnings: - raise SaveWarning(warnings) + raise SaveWarningExc(warnings) def _validate_defaults_to_save(self, value): """Valiations of default values before save.""" diff --git a/openpype/settings/exceptions.py b/openpype/settings/exceptions.py index 758a778794..a06138eeaf 100644 --- a/openpype/settings/exceptions.py +++ b/openpype/settings/exceptions.py @@ -2,10 +2,10 @@ class SaveSettingsValidation(Exception): pass -class SaveWarning(SaveSettingsValidation): +class SaveWarningExc(SaveSettingsValidation): def __init__(self, warnings): if isinstance(warnings, str): warnings = [warnings] self.warnings = warnings msg = " | ".join(warnings) - super(SaveWarning, self).__init__(msg) + super(SaveWarningExc, self).__init__(msg) diff --git a/openpype/settings/lib.py b/openpype/settings/lib.py index c4ed9453f1..9c05c8e86c 100644 --- a/openpype/settings/lib.py +++ b/openpype/settings/lib.py @@ -5,7 +5,7 @@ import logging import platform import copy from .exceptions import ( - SaveWarning + SaveWarningExc ) from .constants import ( M_OVERRIDEN_KEY, @@ -111,7 +111,7 @@ def save_studio_settings(data): data(dict): Overrides data with metadata defying studio overrides. Raises: - SaveWarning: If any module raises the exception. + SaveWarningExc: If any module raises the exception. """ # Notify Pype modules from openpype.modules import ModulesManager, ISettingsChangeListener @@ -129,12 +129,12 @@ def save_studio_settings(data): if isinstance(module, ISettingsChangeListener): try: module.on_system_settings_save(old_data, new_data, changes) - except SaveWarning as exc: + except SaveWarningExc as exc: warnings.extend(exc.warnings) _SETTINGS_HANDLER.save_studio_settings(data) if warnings: - raise SaveWarning(warnings) + raise SaveWarningExc(warnings) @require_handler @@ -155,7 +155,7 @@ def save_project_settings(project_name, overrides): overrides(dict): Overrides data with metadata defying studio overrides. Raises: - SaveWarning: If any module raises the exception. + SaveWarningExc: If any module raises the exception. """ # Notify Pype modules from openpype.modules import ModulesManager, ISettingsChangeListener @@ -184,13 +184,13 @@ def save_project_settings(project_name, overrides): module.on_project_settings_save( old_data, new_data, project_name, changes ) - except SaveWarning as exc: + except SaveWarningExc as exc: warnings.extend(exc.warnings) _SETTINGS_HANDLER.save_project_settings(project_name, overrides) if warnings: - raise SaveWarning(warnings) + raise SaveWarningExc(warnings) @require_handler @@ -211,7 +211,7 @@ def save_project_anatomy(project_name, anatomy_data): overrides(dict): Overrides data with metadata defying studio overrides. Raises: - SaveWarning: If any module raises the exception. + SaveWarningExc: If any module raises the exception. """ # Notify Pype modules from openpype.modules import ModulesManager, ISettingsChangeListener @@ -240,13 +240,13 @@ def save_project_anatomy(project_name, anatomy_data): module.on_project_anatomy_save( old_data, new_data, changes, project_name ) - except SaveWarning as exc: + except SaveWarningExc as exc: warnings.extend(exc.warnings) _SETTINGS_HANDLER.save_project_anatomy(project_name, anatomy_data) if warnings: - raise SaveWarning(warnings) + raise SaveWarningExc(warnings) @require_handler diff --git a/openpype/tools/settings/settings/widgets/categories.py b/openpype/tools/settings/settings/widgets/categories.py index be31a063fe..e4832c989a 100644 --- a/openpype/tools/settings/settings/widgets/categories.py +++ b/openpype/tools/settings/settings/widgets/categories.py @@ -27,7 +27,7 @@ from openpype.settings.entities import ( SchemaError ) -from openpype.settings import SaveWarning +from openpype.settings import SaveWarningExc from .widgets import ProjectListWidget from . import lib @@ -272,7 +272,7 @@ class SettingsCategoryWidget(QtWidgets.QWidget): # not required. self.reset() - except SaveWarning as exc: + except SaveWarningExc as exc: warnings = [ "Settings were saved but few issues happened." ]