def admin(): data = ast.literal_eval(request.data) db = db2.connect_db() db2.insert_into_db(db, [tuple(data)]) # Check mailing list notify.send_emails(db, [tuple(data)]) return 'success'
def login(): data = ast.literal_eval(request.data) user = data[0] db = db2.connect_db() result = str(db2.get_user(db,user)) if result == "True": return "Success" return "Fail"
def emailSO(): data = ast.literal_eval(request.data) print data; print data[0]; print data[1]; print data[2]; notify.funtimes(db2.connect_db(), data[1], data[2], data[0]) return 'success'
def save(): '''add save trip method: for now request data dosn't have user's ID, just hardcode one''' data = ast.literal_eval(request.data) db = db2.connect_db() db1 = db2.connect_db() userID = data[0] data = data[1:] # dt_obj = time.time() # tstamp = datetime.datetime.fromtimestamp(dt_obj).strftime('%Y-%m-%d %H:%M:%S') tstamp = str(datetime.datetime.now()) for i in range(len(data)): parsed = data[i].split("*") attraction = { 'id': parsed[0], 'name': parsed[1], 'category': parsed[2], 'phone': parsed[3], 'address': parsed[4], 'longitude': parsed[5], 'latitude': parsed[6], 'imageurl': parsed[7], } print attraction trip = { 'attractionID': parsed[0], 'name': parsed[1], 'tstamp' : tstamp, 'userID': userID, 'origin': parsed[8], 'destination': parsed[9], } print "**" print trip db2.insert_attraction(db, attraction, "Attractions") db2.insert_trip(db1, trip, "Trips") # skip trip directory for now return "success"
def history(username): db = db2.connect_db() raw_trips = db2.get_history(db, username) all_trips = "" for trip in raw_trips: all_attractions = "" for list_attractions in trip: all_attractions += "@".join(list_attractions) all_attractions += "*" all_trips += all_attractions all_trips += "^" return all_trips
def register(): data = ast.literal_eval(request.data) user = data[0] db = db2.connect_db() return str(db2.insert_user(db,user))
def subscribe(): data = ast.literal_eval(request.data) db = db2.connect_db() db2.insert_into_db(db, [tuple(data)], "contact_list") return 'success'
def testMethod3(): return db2.flask_field_query(db2.connect_db())