def build_reservation(self, logid, liveid, start_time, end_time, vehicleid, modelname, podid, podname, memo, pricetotal): reservation = Reservation(logid,liveid) reservation.start_time = start_time reservation.end_time = end_time if memo: reservation.memo = memo if pricetotal is not None: reservation.price = PriceEstimate() reservation.price.total_amount = pricetotal reservation.vehicle = self.build_vehicle(vehicleid, modelname, podid, podname) return reservation
def build_reservation_from_table_row_element(self, reservation_tr): tds = reservation_tr.findAll('td') reservation = None td_count = 0 for td in tds: if td_count == 0: logid = \ self.get_text_from_element(td) reservation = Reservation(logid) elif td_count == 1: reservation.vehicle = \ self.build_vehicle_from_td_element(td) elif td_count == 2: reservation.start_time = \ self.get_time_from_td_element(td) elif td_count == 3: reservation.end_time = \ self.get_time_from_td_element(td) elif td_count == 4: reservation.price = \ self.build_price_from_td_element(td) # elif td_count == 5: # reservation.status = \ # self.get_text_from_element(td) elif td_count == 6: reservation.memo = \ self.get_text_from_element(td) elif td_count == 7: liveid = self.decode_reservation_liveid_from_td_element(td) if liveid is not None: reservation.liveid = liveid td_count += 1 return reservation