示例#1
0
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)
示例#2
0
文件: entities.py 项目: e6/datawi.re
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)
示例#3
0
文件: entities.py 项目: e6/datawi.re
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)
示例#4
0
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)
示例#5
0
文件: entities.py 项目: e6/datawi.re
def create():
    require.logged_in()
    entity = Entity.create(request.form, request.user)
    db.session.commit()
    publish(entity_queue, "entity.create", entity)
    return jsonify(entity)
示例#6
0
文件: entities.py 项目: e6/datawi.re
def get(id):
    require.logged_in()
    entity = obj_or_404(Entity.by_user_and_id(request.user, id))
    return jsonify(entity)
示例#7
0
def profile_save():
    print request.data
    require.logged_in()
    request.user.update(request.form)
    db.session.commit()
    return profile_get()
示例#8
0
def profile_get():
    require.logged_in()
    data = request.user.to_dict()
    data['api_key'] = request.user.api_key
    data['email'] = request.user.email
    return jsonify(data)
示例#9
0
def create():
    require.logged_in()
    entity = Entity.create(request.form, request.user)
    db.session.commit()
    publish(entity_queue, 'entity.create', entity)
    return jsonify(entity)
示例#10
0
def get(id):
    require.logged_in()
    entity = obj_or_404(Entity.by_user_and_id(request.user, id))
    return jsonify(entity)