Looking at register()
, the format is as following:
def register():
if request.method == "POST":
if request.form['register'] == 'Register':
stuff()
return render_template("register.html",pageType=['register'])
This can easily be condensed using and
:
def register():
if request.method == "POST" and request.form['register'] == 'Register':
stuff()
return render_template("register.html", pageType=['register'])
Also, you are not inserting whitespaces between arguments.
stuff(3,3) # <--Unconventional
stuff(3, 3) # <--More conventional
Another stylistic issue is some of your lines are too long. For all lines, line.length <= 79
. You can read about the specific python conventions on the Python website.
For making it look less messy and repetitive, look at this answer to a Stack Overflow question this answer to a Stack Overflow question. It is about implementing switch
and case
statements into Python, which seems perfect for your situation.
Looking at register()
, the format is as following:
def register():
if request.method == "POST":
if request.form['register'] == 'Register':
stuff()
return render_template("register.html",pageType=['register'])
This can easily be condensed using and
:
def register():
if request.method == "POST" and request.form['register'] == 'Register':
stuff()
return render_template("register.html", pageType=['register'])
Also, you are not inserting whitespaces between arguments.
stuff(3,3) # <--Unconventional
stuff(3, 3) # <--More conventional
Another stylistic issue is some of your lines are too long. For all lines, line.length <= 79
. You can read about the specific python conventions on the Python website.
For making it look less messy and repetitive, look at this answer to a Stack Overflow question. It is about implementing switch
and case
statements into Python, which seems perfect for your situation.
Looking at register()
, the format is as following:
def register():
if request.method == "POST":
if request.form['register'] == 'Register':
stuff()
return render_template("register.html",pageType=['register'])
This can easily be condensed using and
:
def register():
if request.method == "POST" and request.form['register'] == 'Register':
stuff()
return render_template("register.html", pageType=['register'])
Also, you are not inserting whitespaces between arguments.
stuff(3,3) # <--Unconventional
stuff(3, 3) # <--More conventional
Another stylistic issue is some of your lines are too long. For all lines, line.length <= 79
. You can read about the specific python conventions on the Python website.
For making it look less messy and repetitive, look at this answer to a Stack Overflow question. It is about implementing switch
and case
statements into Python, which seems perfect for your situation.
Looking at register()
, the format is as following:
def register():
if request.method == "POST":
if request.form['register'] == 'Register':
stuff()
return render_template("register.html",pageType=['register'])
This can easily be condensed using and
:
def register():
if request.method == "POST" and request.form['register'] == 'Register':
stuff()
return render_template("register.html", pageType=['register'])
Also, you are not inserting whitespaces between arguments.
stuff(3,3) # <--Unconventional
stuff(3, 3) # <--More conventional
Another stylistic issue is some of your lines are too long. For all lines, line.length <= 79
. You can read about the specific python conventions on the Python website.
For making it look less messy and repetitive, look at this answer to a Stack Overflow question. It is about implementing switch
and case
statements into Python, which seems perfect for your situation.