Beispiel #1
0
def check_file_exists(box_name, user_id):
    user = current_user
    if user_id != str(current_user.id):
        if not current_user.is_consultant:
            raise Forbidden()
        user = User.by_id(user_id)

    couch_box = get_couch_box_db(user, box_name)
    couch = CouchFileBox(current_app.config.get('COUCH_DB_URL'), couch_box)
    existing_doc = couch.get(request.form['filename'])
    if existing_doc:
        return jsonify(existing=True)
    return jsonify(existing=False)
Beispiel #2
0
def check_file_exists(box_name, user_id):
    user = current_user
    if user_id != str(current_user.id):
        if not current_user.is_consultant:
            raise Forbidden()
        user = User.by_id(user_id)

    couch_box = get_couch_box_db(user, box_name)
    couch = CouchFileBox(current_app.config.get('COUCH_DB_URL'), couch_box)
    existing_doc = couch.get(request.form['filename'])
    if existing_doc:
        return jsonify(existing=True)
    return jsonify(existing=False)