fridge_items.py 文件源码

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

项目:server-application 作者: foodshipper 项目源码 文件源码
def delete(self, ean):
        try:
            args = parser.parse_args()
        except Exception:
            return abort(400, message="Invalid arguments")
        with db:
            with db.cursor() as cursor:
                user_id = id_from_token(args['token'])

                cursor.execute("DELETE FROM fridge_items WHERE ean=%s AND fridge_items.user_id=%s", [ean, user_id])
                if cursor.rowcount == 1:
                    return None, 200
                else:
                    abort(404, message="Fridge item does not exist")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号