def resource_validation_show(context, data_dict):
u'''
Display the validation job result for a particular resource.
Returns a validation object, including the validation report or errors
and metadata about the validation like the timestamp and current status.
Validation status can be one of:
* `created`: The validation job is in the processing queue
* `running`: Validation is under way
* `error`: There was an error while performing the validation, eg the file
could not be downloaded or there was an error reading it
* `success`: Validation was performed, and no issues were found
* `failure`: Validation was performed, and there were issues found
:param resource_id: id of the resource to validate
:type resource_id: string
:rtype: dict
'''
t.check_access(u'resource_validation_show', context, data_dict)
if not data_dict.get(u'resource_id'):
raise t.ValidationError({u'resource_id': u'Missing value'})
Session = context['model'].Session
try:
validation = Session.query(Validation).filter(
Validation.resource_id == data_dict['resource_id']).one()
except NoResultFound:
validation = None
if not validation:
raise t.ObjectNotFound(
'No validation report exists for this resource')
return _validation_dictize(validation)
评论列表
文章目录