From 3f2592d631ee6469e530c103bc39ba0417b3a77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Wed, 11 Nov 2020 13:55:29 -0600 Subject: [PATCH] Small adjustment on sign_out function (#603) * Small adjustment on sing_out function First, thanks for this. It has been a great help. I was having trouble with this function, getting a TypeError (TypeError: can only concatenate str (not "NoneType") to str) because apparently the second os.remove(session_cache_path()) is trying to delete a file that does not exist anymore so this is what worked for me. * Change description on app.py file * Update app.py on line 79 Fixed indent --- CHANGELOG.md | 3 ++- examples/app.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43e26bd..010cc74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -// Add your changes here and then delete this line +### Changed +- moved os.remove(session_cache_path()) inside try block to avoid TypeError on app.py example file ## [2.16.1] - 2020-10-24 diff --git a/examples/app.py b/examples/app.py index 5b93c10..188b4eb 100644 --- a/examples/app.py +++ b/examples/app.py @@ -73,11 +73,10 @@ def index(): @app.route('/sign_out') def sign_out(): - os.remove(session_cache_path()) - session.clear() try: # Remove the CACHE file (.cache-test) so that a new user can authorize. os.remove(session_cache_path()) + session.clear() except OSError as e: print ("Error: %s - %s." % (e.filename, e.strerror)) return redirect('/')