datasets.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:kge-server 作者: vfrico 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号