def notes_storage(): """ Sending a GET request to this URL retrieves the notes associated with the user logged in (checked via the session). Sending a POST request updates the shelf with the provided new values. JavaScript calls this function to save/load notes. """ if 'username' not in session: abort(401) with closing(shelve.open(users_file)) as user_shelf: users = Users(user_shelf) if request.method == 'GET': return users.stickies_for_user(session['username']) else: data = request.form['noteSet'] users.save_stickies_for_user(session['username'], data) return 'Post successful'