def get_session(): cookie = bottle.request.get_cookie("session") if cookie == None: print "Sorry, no cookie in the cookie jar" return None else: session_id = manage_users.get_session_from_cookie(cookie) if (session_id == None): print "Sorry, your cookie didn't generate properly" return None else: session = manage_users.get_session_from_db(session_id) return session
def get_session(): """ Retrieves session from browser's stored cookie, if the session is valid """ cookie = bottle.request.get_cookie("session") if not cookie: print "Sorry, no cookie in the cookie jar" return None else: session_id = manage_users.get_session_from_cookie(cookie) if not session_id: print "Sorry, your cookie didn't generate properly" return None else: session = manage_users.get_session_from_db(session_id) return session
def get_session(): """ Extracts the session from the browser's cookie """ cookie = bottle.request.get_cookie("session") if cookie == None: print "Sorry, no cookie in the cookie jar" return None else: session_id = manage_users.get_session_from_cookie(cookie) if session_id: session = manage_users.get_session_from_db(session_id) return session else: print "Sorry, your cookie didn't generate properly" return None