Loading services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/core/internal_service_ops.py +0 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,6 @@ class InternalServiceOps(Resource): allowed_invocations_per_second = 0 time_range_days = 0 res = mycol.find_one( {"service_id": service_id, "aef_id": aef_id}, {"_id": 0}) Loading services/helper/helper_service/utils/utils.py +6 −6 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ def validate_snake_case_keys(obj, path="root"): def get_nested_value(config, path): """ Obtiene un valor dentro de un diccionario anidado siguiendo una ruta de claves separadas por puntos. Gets a value within a nested dictionary by following a path of keys separated by periods. """ keys = path.split('.') for key in keys: Loading @@ -48,28 +48,28 @@ def get_nested_value(config, path): def convert_value_to_original_type(new_value, current_value): """ Convierte new_value al tipo de current_value si es posible. Convert new_value to the type of current_value. """ if isinstance(current_value, int): try: return int(new_value) except ValueError: return jsonify(message=f"Valor inválido: {new_value} no es un entero"), 400 return jsonify(message=f"Invalid value: {new_value} is not an integer"), 400 elif isinstance(current_value, float): try: return float(new_value) except ValueError: return jsonify(message=f"Valor inválido: {new_value} no es un flotante"), 400 return jsonify(message=f"Invalid value: {new_value} is not a float"), 400 elif isinstance(current_value, bool): if isinstance(new_value, str) and new_value.lower() in ["true", "false"]: return new_value.lower() == "true" elif not isinstance(new_value, bool): return jsonify(message=f"Valor inválido: {new_value} no es un booleano"), 400 return jsonify(message=f"Invalid value: {new_value} is not a boolean"), 400 return new_value def convert_nested_values(new_data, reference_data): """ Recorre recursivamente new_data y convierte los valores al tipo original basado en reference_data. Recursively traverses new_data and converts values back to the original type based on reference_data. """ if isinstance(new_data, dict) and isinstance(reference_data, dict): for key, value in new_data.items(): Loading Loading
services/TS29222_CAPIF_Access_Control_Policy_API/capif_acl/core/internal_service_ops.py +0 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,6 @@ class InternalServiceOps(Resource): allowed_invocations_per_second = 0 time_range_days = 0 res = mycol.find_one( {"service_id": service_id, "aef_id": aef_id}, {"_id": 0}) Loading
services/helper/helper_service/utils/utils.py +6 −6 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ def validate_snake_case_keys(obj, path="root"): def get_nested_value(config, path): """ Obtiene un valor dentro de un diccionario anidado siguiendo una ruta de claves separadas por puntos. Gets a value within a nested dictionary by following a path of keys separated by periods. """ keys = path.split('.') for key in keys: Loading @@ -48,28 +48,28 @@ def get_nested_value(config, path): def convert_value_to_original_type(new_value, current_value): """ Convierte new_value al tipo de current_value si es posible. Convert new_value to the type of current_value. """ if isinstance(current_value, int): try: return int(new_value) except ValueError: return jsonify(message=f"Valor inválido: {new_value} no es un entero"), 400 return jsonify(message=f"Invalid value: {new_value} is not an integer"), 400 elif isinstance(current_value, float): try: return float(new_value) except ValueError: return jsonify(message=f"Valor inválido: {new_value} no es un flotante"), 400 return jsonify(message=f"Invalid value: {new_value} is not a float"), 400 elif isinstance(current_value, bool): if isinstance(new_value, str) and new_value.lower() in ["true", "false"]: return new_value.lower() == "true" elif not isinstance(new_value, bool): return jsonify(message=f"Valor inválido: {new_value} no es un booleano"), 400 return jsonify(message=f"Invalid value: {new_value} is not a boolean"), 400 return new_value def convert_nested_values(new_data, reference_data): """ Recorre recursivamente new_data y convierte los valores al tipo original basado en reference_data. Recursively traverses new_data and converts values back to the original type based on reference_data. """ if isinstance(new_data, dict) and isinstance(reference_data, dict): for key, value in new_data.items(): Loading