def add_friend(): my_username = login_check() friend_username = bottle.request.forms.get("username") errors = {'username':cgi.escape(friend_username)} connection = pymongo.Connection(connection_string, safe=True) if (friend.new_friend_request(connection, my_username, friend_username, errors)): bottle.redirect("/main") else: return bottle.template("add_friend", errors)
def add_friend(): my_username = login_check() friend_username = bottle.request.forms.get("username") errors = {'username': cgi.escape(friend_username)} connection = pymongo.Connection(connection_string, safe=True) if (friend.new_friend_request(connection, my_username, friend_username, errors)): bottle.redirect("/main") else: return bottle.template("add_friend", errors)
def add_friend(): my_username = login_check() friend_username = None try: friend_username = request.query['friend'] except KeyError: redirect("/main") errors = {'username': cgi.escape(friend_username)} connection = pymongo.Connection(connection_string, safe=True) if friend.new_friend_request(connection, my_username, friend_username, errors): redirect("/main") else: return template("add_friend", errors)
def add_friend(): my_username = login_check() friend_username = None try: friend_username = request.query['friend'] except KeyError: redirect("/main") errors = {'username': cgi.escape(friend_username)} connection = pymongo.Connection(connection_string, safe=True) if friend.new_friend_request(connection, my_username, friend_username, errors): redirect("/main") else: return template("add_friend", errors)