Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python flask flash message exception remains after restarting

Tags:

python

flask

I'm making a small flask app where I had something like this:

@app.route('/bye')
def logout():
    session.pop('logged_in', None)
    flash('Adiós')
    return redirect('/index')

Needless to say when I ran the application and I navigated to '/bye' it gave me a UnicodeDecodeError. Well, now it gives me the same unicodedecodeerror on every page that extends the base template (which renders the messages) even after restarting the application. and always with the same dump() despite removing that flash in the source code. All I can think of is what the crap? Help please.

Well I had to restart my computer to clear the stupid session cache or something.

like image 320
user1070036 Avatar asked Oct 22 '13 18:10

user1070036


1 Answers

I think that flash() actually creates a session called session['_flashes']. See this code here. So you will probably have to either:

clear/delete the cookie 

OR

session.pop('_flashes', None)
like image 62
codegeek Avatar answered Oct 31 '22 21:10

codegeek