diff --git a/pype/ftrack/actions/action_djvview.py b/pype/ftrack/actions/action_djvview.py index 9da12dd67c..2467a443bb 100644 --- a/pype/ftrack/actions/action_djvview.py +++ b/pype/ftrack/actions/action_djvview.py @@ -36,12 +36,13 @@ class DJVViewAction(BaseAction): 'file_ext', ["img", "mov", "exr"] ) - def register(self): - assert (self.djv_path is not None), ( - 'DJV View is not installed' - ' or paths in presets are not set correctly' - ) - super().register() + def preregister(self): + if self.djv_path is None: + return ( + 'DJV View is not installed' + ' or paths in presets are not set correctly' + ) + return True def discover(self, session, entities, event): """Return available actions based on *event*. """ diff --git a/pype/ftrack/actions/action_rv.py b/pype/ftrack/actions/action_rv.py index e32997e5a9..76a23b1d67 100644 --- a/pype/ftrack/actions/action_rv.py +++ b/pype/ftrack/actions/action_rv.py @@ -61,12 +61,12 @@ class RVAction(BaseAction): def set_rv_path(self): self.rv_path = self.config_data.get("rv_path") - def register(self): - assert (self.rv_path is not None), ( - 'RV is not installed' - ' or paths in presets are not set correctly' - ) - super().register() + def preregister(self): + if self.rv_path is None: + return ( + 'RV is not installed or paths in presets are not set correctly' + ) + return True def get_components_from_entity(self, session, entity, components): """Get components from various entity types. diff --git a/pype/ftrack/lib/ftrack_base_handler.py b/pype/ftrack/lib/ftrack_base_handler.py index 13e1cae9a9..f22f80e7f1 100644 --- a/pype/ftrack/lib/ftrack_base_handler.py +++ b/pype/ftrack/lib/ftrack_base_handler.py @@ -13,6 +13,13 @@ class MissingPermision(Exception): super().__init__(message) +class PreregisterException(Exception): + def __init__(self, message=None): + if not message: + message = "Pre-registration conditions were not met" + super().__init__(message) + + class BaseHandler(object): '''Custom Action base class @@ -89,15 +96,17 @@ class BaseHandler(object): '!{} "{}" - You\'re missing required {} permissions' ).format(self.type, label, str(MPE))) except AssertionError as ae: - self.log.info(( + self.log.warning(( '!{} "{}" - {}' ).format(self.type, label, str(ae))) except NotImplementedError: self.log.error(( '{} "{}" - Register method is not implemented' - ).format( - self.type, label) - ) + ).format(self.type, label)) + except PreregisterException as exc: + self.log.warning(( + '{} "{}" - {}' + ).format(self.type, label, str(exc))) except Exception as e: self.log.error('{} "{}" - Registration failed ({})'.format( self.type, label, str(e)) @@ -163,10 +172,10 @@ class BaseHandler(object): if result is True: return - msg = "Pre-register conditions were not met" + msg = None if isinstance(result, str): msg = result - raise Exception(msg) + raise PreregisterException(msg) def preregister(self): '''