コード例 #1
0
ファイル: schema_utils.py プロジェクト: eyalmnm/3D_Gallery
        def wrapper(*args, **kwargs):
            valid = True
            err_str = None
            try:
                data = schema.loads(request.data)
            except ValidationError as err:
                valid = False
                print({
                    "message": "error validating schema",
                    "request body": json.loads(request.data),
                    "function": func.__name__
                })
            except Exception as err:
                valid = False
                err_str = str(err)
                print({
                    "message": "could not parse request body",
                    "request body": request.data,
                    "function": func.__name__
                })
            if valid is False:
                err_msg = "could not parse request body"
                if err_str:
                    err_msg = err_msg + ": " + err_str
                return jsonify(
                    create_error_response(
                        ErrorCodes.VALIDATE_INPUT_SCHEMA_FAILED, err_msg))

            return func(data, *args, **kwargs)
コード例 #2
0
def generate_pic_size_not_found_response(pic_size_id):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_PIC_SIZE_NOT_FOUND,
                              'Pic Size not found: ' + pic_size_id))
コード例 #3
0
def generate_user_not_authorised_response():
    return json.dumps(
        create_error_response(ErrorCodes.ERROR_CODE_USER_NOT_AUTHORIZED, 'User not authorized for this action'))
コード例 #4
0
def generate_default_value_not_found_response():
    return json.dumps(
        create_error_response(ErrorCodes.ERROR_CODE_DEFAULT_TEXTURE_NOT_FOUND, 'default texture not found'))
コード例 #5
0
def generate_painting_contains_real_sizes_response(painting_id):
    return jsonify(create_error_response(ErrorCodes.ERROR_CODE_PAINTING_CONTAINS_REAL_SIZES, 'Painting ' + painting_id + ' contains \
                Real Sizes and cant be removed'))
コード例 #6
0
ファイル: wall_manager.py プロジェクト: eyalmnm/3D_Gallery
def generate_wall_not_found_response(wall_id):
    return json.dumps(create_error_response(ErrorCodes.ERROR_CODE_WALL_NOT_FOUND, 'Wall not found: ' + wall_id))
コード例 #7
0
def generate_global_settings_not_found_response_id(s_id):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_GLOBAL_SETTINGS_NOT_FOUND, 'global settings not found : ' + s_id))
コード例 #8
0
def generate_floor_not_found_response(id):
    return json.dumps(
        create_error_response(ErrorCodes.ERROR_CODE_FLOOR_NOT_FOUND,
                              'Floor not found: ' + str(id)))
コード例 #9
0
ファイル: user_manager.py プロジェクト: eyalmnm/3D_Gallery
def generate_registration_failed_response(exe):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_REGISTRATION_FAILED,
                              'User registration failed ' + str(exe)))
コード例 #10
0
def generate_floor_name_already_exist_response(name):
    return json.dumps(
        create_error_response(ErrorCodes.ERROR_CODE_FLOOR_ALREADY_EXIST,
                              'Floor ' + name + ' already exist'))
コード例 #11
0
ファイル: user_manager.py プロジェクト: eyalmnm/3D_Gallery
def generate_username_taken_response(username):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_USERNAME_ALREADY_TAKEN,
                              'Username already taken: ' + username))
コード例 #12
0
ファイル: user_manager.py プロジェクト: eyalmnm/3D_Gallery
def generate_login_failed_response():
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_LOGIN_FAILED,
                              'Username and Password not found'))
コード例 #13
0
def generate_painting_contains_bg_lights_response(painting_id):
    return jsonify(create_error_response(ErrorCodes.ERROR_CODE_PAINTING_CONTAINS_BG_LIGHTS, 'Painting ' + painting_id + ' contains \
        Bg Lights and cant be removed'))
コード例 #14
0
def generate_texture_not_found_response(texture_id):
    return json.dumps(
        create_error_response(ErrorCodes.ERROR_CODE_TEXTURE_NOT_FOUND,
                              'texture not found: ' + str(texture_id.item_id)))
コード例 #15
0
def generate_room_name_already_exist_response(name):
    return json.dumps(
        create_error_response(ErrorCodes.ERROR_CODE_ROOM_ALREADY_EXIST, 'Room ' + name + ' already exist'))
コード例 #16
0
def generate_real_size_not_found_response(real_size_id):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_REAL_SIZE_NOT_FOUND,
                              'Real Size not found: ' + real_size_id))
コード例 #17
0
def generate_room_not_found_response(room_id):
    return json.dumps(create_error_response(ErrorCodes.ERROR_CODE_ROOM_NOT_FOUND, 'Room not found: ' + str(room_id)))
コード例 #18
0
def generate_global_settings_not_found_response():
    msg = create_error_response(ErrorCodes.ERROR_CODE_GLOBAL_SETTINGS_NOT_FOUND, 'global settings not found')
    return jsonify(msg)
コード例 #19
0
def generate_room_contains_walls_response(room_id):
    return json.dumps(create_error_response(ErrorCodes.ERROR_CODE_ROOM_CONTAINS_WALLS, 'Room ' + str(room_id) + ' contains \
    walls and cant be removed'))
コード例 #20
0
ファイル: wall_manager.py プロジェクト: eyalmnm/3D_Gallery
def generate_user_not_login_response():
    return json.dumps(create_error_response(ErrorCodes.ERROR_CODE_USER_NOT_LOGGED_IN, 'User not logged in'))
コード例 #21
0
def generate_bg_light_not_found_response(bg_light_id):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_BG_LIGHT_NOT_FOUND,
                              'Bg Light not found: ' + bg_light_id))
コード例 #22
0
ファイル: wall_manager.py プロジェクト: eyalmnm/3D_Gallery
def generate_wall_contains_paintings_response(wall_id):
    return json.dumps(create_error_response(ErrorCodes.ERROR_CODE_WALL_CONTAINS_PAINTINGS, 'Wall ' + wall_id + ' contains \
        paintings and cant be removed'))
コード例 #23
0
def generate_painting_not_found_response(painting_id):
    return jsonify(
        create_error_response(ErrorCodes.ERROR_CODE_PAINTING_NOT_FOUND, 'Painting not found: ' + painting_id))