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 create(): require.logged_in() entity = Entity.create(request.form, request.user) db.session.commit() publish(entity_queue, "entity.create", entity) return jsonify(entity)
def get(id): require.logged_in() entity = obj_or_404(Entity.by_user_and_id(request.user, id)) return jsonify(entity)
def profile_save(): print request.data require.logged_in() request.user.update(request.form) db.session.commit() return profile_get()
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)
def create(): require.logged_in() entity = Entity.create(request.form, request.user) db.session.commit() publish(entity_queue, 'entity.create', entity) return jsonify(entity)