コード例 #1
0
 def getFuelByLocation(self, location):
     dao = FuelDAO()
     fuel_list = dao.getFuelByLocation(location)
     result_list = []
     for row in fuel_list:
         result = self.build_Fuel_dict(row)
         result_list.append(result)
     return jsonify(Fuel=result_list)
コード例 #2
0
 def searchFuel(self, args):
     if len(args) > 1:
         return jsonify(Error="Malformed search string."), 400
     else:
         location = args.get("location")
         if location:
             dao = FuelDAO()
             fuel_list = dao.getFuelByLocation()
             # result_list = []
             # for row in fuel_list:
             #     result = self.build_fuel_dict(row)
             #     result_list.append(row)
             return jsonify(Fuel=fuel_list)
         else:
             return jsonify(Error="Malformed search string."), 400