def put_location(location): """ pulls xml 'floor' and 'room' from xml tag 'location', makes Building DB object via function, associates it all together in a DB Location object Keyword arguments: location -- xml tag 'location' return reference to DB Location object """ building = put_building(location.find('building')) floor = get_text(location.find('floor')) room = get_text(location.find('room')) return Faculty4.addLocation(building, floor, room)
def put_offices(offices): """ makes DB Office objects, associating them with their person Keyword arguments: person_handle -- person that owns these offices offices -- list of offices to associate with person no return """ l = [] for office in offices: building = put_building(office.find('building')) floor = get_text(office.find('floor')) room = get_text(office.find('room')) location = Faculty4.addLocation(building, floor, room) l.append(Faculty4.addOffice(location)) return l