Beispiel #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)
Beispiel #2
0
        items.append(res)

    return serialize({'result': items})

@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():