def delete(id): require.logged_in() entity = obj_or_404(Entity.by_user_and_id(request.user, id)) publish(entity_queue, "entity.delete", entity) entity.delete() db.session.commit() return jsonify({"status": "gone"}, status=410)
def delete(id): require.logged_in() entity = obj_or_404(Entity.by_user_and_id(request.user, id)) publish(entity_queue, 'entity.delete', entity) entity.delete() db.session.commit() return jsonify({'status': 'gone'}, status=410)
def update(id): require.logged_in() entity = obj_or_404(Entity.by_user_and_id(request.user, id)) data = {"old": entity.to_dict()} entity.update(request.form) db.session.commit() data["new"] = entity publish(entity_queue, "entity.update", data) return jsonify(entity)
def update(id): require.logged_in() entity = obj_or_404(Entity.by_user_and_id(request.user, id)) data = {'old': entity.to_dict()} entity.update(request.form) db.session.commit() data['new'] = entity publish(entity_queue, 'entity.update', data) return jsonify(entity)
def get(id): require.logged_in() entity = obj_or_404(Entity.by_user_and_id(request.user, id)) return jsonify(entity)