Exemplo n.º 1
0
def reset_sync():
    data = request.json
    if not data.get('id'):
        return jsonify(error='missing id')
    Sync.update({'_id': ObjectId(data['id'])},
            {'$set': {'reserved': None}}, safe=True)
    return jsonify(result=True)
Exemplo n.º 2
0
@crossdomain(origin='*')
def list_users():
    users = [_get_user(u) for u in get_users()]
    return serialize({'result': users})

@app.route('/sync/update', methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def update_sync():
    data = request.json
    if not data.get('_id'):
        return jsonify(error='missing id')
    try:
        sync = _get_sync(data)
    except SyncError, e:
        return jsonify(error=str(e))
    Sync.update({'_id': ObjectId(data['_id'])},
            {'$set': sync}, safe=True)
    return jsonify(result=True)

@app.route('/sync/reset', methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def reset_sync():
    data = request.json
    if not data.get('id'):
        return jsonify(error='missing id')
    Sync.update({'_id': ObjectId(data['id'])},
            {'$set': {'reserved': None}}, safe=True)
    return jsonify(result=True)

@app.route('/sync/remove', methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def remove_sync():