def do_calculate_hotel_rating(request, response): current_index_str = param.get('current_hotel_index') if current_index_str == None: current_index = 0 else: current_index = int(current_index_str) + 1 hotels = place.get_hotels() if len(hotels) <= current_index: current_index = 0 hotel = hotels[current_index] rater.get(hotel) param.add('current_hotel_index', str(current_index)) response.out.write('Processed the rating of hotel ' + hotel.name) logging.info('Processed the rating of hotel ' + hotel.name)
def do_hotel(request, response, name): hotel = place.get(name)[0] ratings = rater.get(hotel) data = { 'hotel': hotel, 'ratings': ratings } view.to_html(data, 'hotel', request, response)