From b7afe4f52859b147e597b7b6606ec9365a645f64 Mon Sep 17 00:00:00 2001 From: Jonas Linter Date: Wed, 1 Oct 2025 16:43:50 +0200 Subject: [PATCH] Fixed some shoddy typing --- src/alpine_bits_python/alpine_bits_helpers.py | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/alpine_bits_python/alpine_bits_helpers.py b/src/alpine_bits_python/alpine_bits_helpers.py index 1325818..cb5ef99 100644 --- a/src/alpine_bits_python/alpine_bits_helpers.py +++ b/src/alpine_bits_python/alpine_bits_helpers.py @@ -741,9 +741,18 @@ def create_xml_from_db(list: list[Tuple[Reservation, Customer]]): room_stays = OtaResRetrieveRs.ReservationsList.HotelReservation.RoomStays( room_stay=[room_stay], ) + klick_id = reservation.fbclid or reservation.gclid + + + + if klick_id in (None, "", "None"): + klick_id = None + else: # extract string from Column object + klick_id = str(klick_id) + hotel_res_id_data = HotelReservationIdData( res_id_type="13", - res_id_value=reservation.fbclid or reservation.gclid, + res_id_value=klick_id, res_id_source=None, res_id_source_context="99tales", ) @@ -754,9 +763,19 @@ def create_xml_from_db(list: list[Tuple[Reservation, Customer]]): hotel_res_ids = OtaResRetrieveRs.ReservationsList.HotelReservation.ResGlobalInfo.HotelReservationIds( hotel_reservation_id=[hotel_res_id] ) + + if reservation.hotel_code is None: + raise ValueError("Reservation hotel_code is None") + else: + hotel_code = str(reservation.hotel_code) + if reservation.hotel_name is None: + hotel_name = None + else: + hotel_name = str(reservation.hotel_name) + basic_property_info = OtaResRetrieveRs.ReservationsList.HotelReservation.ResGlobalInfo.BasicPropertyInfo( - hotel_code=reservation.hotel_code, - hotel_name=reservation.hotel_name, + hotel_code=hotel_code, + hotel_name=hotel_name, ) # Comments