def validate_converter(self): converter = get_converter(self.converter_type) try: converter.safe_convert(self.content) except ConverterError: return [InvalidConverterProblem(self.content, self.converter_type)] return []
def validate_converter(self): converter = get_converter(self.converter_type) try: converter.safe_convert(self.content) except ConverterError: return [InvalidConverterProblem(self.content, self.converter_type)] return []
def _convert_params_values(self): problems = [] for param_name, converter_type in six.iteritems(self.PARAMS): param_val = self.params.get(param_name) if param_val is not None: converter = get_converter(converter_type) try: converted_val = converter.safe_convert(param_val) except ConverterError: problems.append(ParamConversionProblem(param_name, param_val, converter_type)) else: self.params[param_name] = converted_val return problems