def validate_configuration(self, configuration): try: validate_JSON_instance(schema=self.configuration_schema, instance=configuration) except ValidationError as error: msg = _('Invalid device configuration. Error: %(error)s') params = dict(error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _('Invalid licence metadata. Error: %(error)s') params = dict(error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _('Invalid metadata for sampling event of type ' '%(type)s. Error: %(error)s') params = dict(type=str(self), error=str(error)) raise ValidationError(str(msg), params=params)
def validate_id_info(self, id_info): try: validate_JSON_instance(schema=self.additional_id_info_schema, instance=id_info) except ValidationError as error: msg = _('Invalid identification information for organism ' 'type %(type)s. Error: %(error)s') params = dict(type=self.name, error=', '.join(error.messages)) raise ValidationError(msg, params=params)
def validate_synonym_metadata(self, metadata): try: validate_JSON_instance(schema=self.synonym_metadata_schema, instance=metadata) except ValidationError as error: msg = _('Invalid metadata for synonym of terms of type ' '%(type)s. Error: %(error)s') params = dict(type=str(self), error=str(error)) raise ValidationError(msg % params)
def validate_additional_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _('Invalid additional metadata for organism capture ' 'type %(type)s. Error: %(error)s') params = dict(type=self.name, error=', '.join(error.messages)) raise ValidationError(msg, params=params)
def validate_media_info(self, media_info): try: validate_JSON_instance(schema=self.media_info_schema, instance=media_info) except ValidationError as error: msg = _('Invalid media info for item of type %(type)s. ' 'Error %(error)s') params = dict(type=str(self), error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _( 'Invalid metadata for entailment between terms of types %(entailment)s. Error: %(error)s' ) params = dict(entailment=str(self), error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _( 'Invalid collection metadata for collection of type %(type)s. ' 'Error: %(error)s') params = dict(type=str(self), error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _('Invalid metadata for item type %(type)s in collection ' '%(collection). Error: %(error)') params = dict(type=str(self.item_type), collection_type=str(self.collection_type), error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance(schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _( 'Invalid metadata for device of type %(device)s in sampling' 'event of type %(sampling_event)s. Error: %(error)') params = dict(device=str(self.device_type), sampling_event=str(self.sampling_event_type), error=str(error)) raise ValidationError(msg, params=params)
def validate_metadata(self, metadata): try: validate_JSON_instance( schema=self.metadata_schema, instance=metadata) except ValidationError as error: msg = _( 'Invalid metadata for user of role type %(type)s ' 'in collection %(collection)s. Error: %(error)s') params = dict( type=str(self.role), collection=str(self.collection_type), error=str(error)) raise ValidationError(msg, params=params)