def putAirline(self, airline_list): try: for one in airline_list: ret = one.split('-') airline = AirlineInfo() airline.takeoff_city = ret[0] airline.arrival_city = ret[1] airline.add() except: msg = traceback.format_exc() self.logger.error(msg) DBBase.Session.rollback() DBBase.Engine.dispose() return None
def getAirlineList(self): try: ret = AirlineInfo.find() airline_list = [] for one in ret: hash = {} #@ReservedAssignment hash['takeoff_city'] = one.takeoff_city hash['arrival_city'] = one.arrival_city airline_list.append(hash) return airline_list except: msg = traceback.format_exc() self.logger.error(msg) DBBase.Session.rollback() DBBase.Engine.dispose() return None