views.py 文件源码

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

项目:jawaf 作者: danpozmanter 项目源码 文件源码
def post(self, request, table_name=None):
        """Post endpoint. Create a new row.
        :param request: Sanic Request.
        :param table_name: Name of the table to access.
        """
        if not check_csrf(request):
            return json({'message': 'access denied'}, status=403)
        waf = get_jawaf()
        table = registry.get(table_name)
        if not table:
            return json({'message': 'access denied'}, status=403)
        async with Connection(table['database']) as con:
            stmt = table['table'].insert().values(**request.json)
            await con.execute(stmt)
        await add_audit_action('post', 'admin', table_name, request['session']['user'])
        return json({'message': 'success'}, status=201)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号