Ejemplo n.º 1
0
   def post(self):
	print flask.request.data
        input = flask.request.form['searchInput']
        a = db_food()
        b = db_restaurant()
        
        resultList = a.search(input.encode('utf-8'))
        
        finalresult = ""
        for result in resultList:
            fooduid = result[0]
            name = result[1]
            resuid = a.getResUIDFromFoodUID(fooduid)
            res = b.getResByUID(resuid)
            resname = res[0].encode('utf-8')
            restel = res[1].encode('utf-8')
            resaddress = res[2].encode('utf-8')
            finalresult += name + "(*****)," + resname + "," + restel + "," + resaddress + " | "
            #finalresult += name + " | "
            
        a.close()
        b.close()
        
        if (finalresult!=""):
            flask.flash(finalresult.decode('utf-8'))
        else:
            flask.flash("Food data not found.")
        return self.get()
Ejemplo n.º 2
0
    resname = getResName(tree)
    if (resname is None):
        continue
    resaddress = getAddress(tree)
    restel = getTel(tree)
    print ""
    print "------------------------"
    print "URL: "+url
    #print "------------------------"
    print "NAME: "+resname
    #print "------------------------"
    print "ADDRESS: "+resaddress
    #print "------------------------"
    print "TEL: "+restel
    #print "------------------------"
    
    d2 = db_restaurant()
    d2.insert(resname.encode('utf-8'),  restel.encode('utf-8'),  resaddress.encode('utf-8'))
    resUID = d2.getUID(resname)
    
    d3 = db_food()
    foodList = getFoodList(tree)
    for food in foodList:
        if (food != ""):
            d3.insert(food)
            foodUID = d3.getUID(food)
            print food + "(" + str(resUID) + "," + str(foodUID) + ")"
            d3.insertFoodRes(foodUID,  resUID)
    print "------------------------"
    print ""