diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models_imports.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py index 26516cb7f..d26a20791 100644 --- a/ishtar_common/models_imports.py +++ b/ishtar_common/models_imports.py @@ -1404,21 +1404,21 @@ class FormaterType(models.Model): if self.options in dir(): model = dir()[self.options] else: + error_msg = str( + _("Configuration error - {} - invalid model for TypeFormater: {}.") + ).format(target, self.options) try: model = import_class(self.options) except (AttributeError, SuspiciousOperation): - logger.warning( - "**WARN FormaterType.get_formater_type**: {} " - "is not in valid.".format(self.options) - ) + raise ImporterError(error_msg) return + if not model: + raise ImporterError(error_msg) + return # must be explicit if non general type if self.options not in TARGET_MODELS_KEYS and \ not [True for m in model.__mro__ if m.__name__ == "GeneralType"]: - logger.warning( - "**WARN FormaterType.get_formater_type**: {} " - "is not in valid.".format(self.options) - ) + raise ImporterError(error_msg) return return TypeFormater(model, **kwargs) elif self.formater_type == "UnicodeFormater": |
