def search(): # check for a cookie, if present, then extract value username = login_check() if username is None: print "main: can't identify user...redirecting to signup" redirect("/signup") try: query = request.query['q'] except KeyError: query = "" try: friend = request.query['friend'] except KeyError: friend = "" connection = pymongo.Connection(connection_string, safe=True) achievements = achievement.find_achievements(connection, query) return template("search_results", friend=friend, q=query, username=username, achievements=achievements)
def search_resultts(): # check for a cookie, if present, then extract value username = login_check() if (username == None): print "main: can't identify user...redirecting to signup" bottle.redirect("/signup") try: query = bottle.request.query['q'] except: query = "" connection = pymongo.Connection(connection_string, safe=True) achievements = achievement.find_achievements(connection, query) return bottle.template("search_results", q=query, username=username, achievements=achievements)