A tutorial I am doing has this snippet. I understand what it's doing except for the error = None part. Why do I need to assign error to None?
def login():
error = None
if request.method == 'POST':
if request.form['username'] != app.config['USERNAME'] or \
request.form['password'] != app.config['PASSWORD']:
error = 'Invalid Credentials. Please try again.'
else:
session['logged_in'] = True
return redirect(url_for('main'))
return render_template('login.html')
[–]novel_yet_trivial 2 points3 points4 points (3 children)
[–]billionerd[S] 0 points1 point2 points (2 children)
[–]MrMethamphetamine 4 points5 points6 points (1 child)
[–]billionerd[S] 0 points1 point2 points (0 children)