description = description, route_type = route_type, url = url, color = color, text_color = text_color) r.route_id = int(route_id) r.gtfs_id = gtfs_id for trip_route_node in tree.getroot().findall('TripRoute'): trip_route_id = trip_route_node.get('id', TripRoute.new_id()) gtfs_id = trip_route_node.get('gtfs_id', None) name = trip_route_node.findtext('name') route_id = trip_route_node.findtext('route_id') calendar_id = trip_route_node.findtext('calendar_id') headsign = trip_route_node.findtext('headsign') direction = trip_route_node.findtext('direction') path_id = trip_route_node.findtext('path_id') route = Route.get(int(route_id)) calendar = Calendar.get(int(calendar_id)) path = None if path_id != '': path = Path.get(int(path_id)) tr = TripRoute(name, route, calendar, headsign, int(direction), path) tr.trip_route_id = int(trip_route_id) tr.gtfs_id = gtfs_id route.add_trip_route(tr) # stops stops_node = trip_route_node.find('Stops') for stop_node in stops_node.findall('Stop'): stop_id = stop_node.get('id')