def on_put(self, req, resp, dataset_id, **kwargs):
"""Change the description of choosen dataset
:param HTTPUserDatasetDTO dataset_info: Object with description param
:param integer dataset_id: Unique ID of dataset
:returns: The dataset with changed values
:rtype: DatasetDTO
"""
dataset_info = HTTPUserDatasetDTO()
try:
dataset_info.load(kwargs["dataset_info"])
except KeyError:
pass
dataset_dao = data_access.DatasetDAO()
if dataset_info.description is not None:
res, err = dataset_dao.set_description(
dataset_id, dataset_info.description)
if res is None:
raise falcon.HTTPInternalServerError(
title="Server Error",
description="Unable to process description param")
resource, err = dataset_dao.get_dataset_by_id(dataset_id)
response = {
"dataset": resource.to_dict(),
}
resp.body = json.dumps(response)
resp.content_type = 'application/json'
resp.status = falcon.HTTP_200
评论列表
文章目录