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
This commit is contained in:
Miguel Ángel 2020-11-11 13:55:29 -06:00 committed by GitHub
parent 8198947428
commit 3f2592d631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased ## 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 ## [2.16.1] - 2020-10-24

View File

@ -73,11 +73,10 @@ def index():
@app.route('/sign_out') @app.route('/sign_out')
def sign_out(): def sign_out():
os.remove(session_cache_path())
session.clear()
try: try:
# Remove the CACHE file (.cache-test) so that a new user can authorize. # Remove the CACHE file (.cache-test) so that a new user can authorize.
os.remove(session_cache_path()) os.remove(session_cache_path())
session.clear()
except OSError as e: except OSError as e:
print ("Error: %s - %s." % (e.filename, e.strerror)) print ("Error: %s - %s." % (e.filename, e.strerror))
return redirect('/') return redirect('/')