From 41ccc34e831d05cc4366fc41c5a5243d75ff8ee1 Mon Sep 17 00:00:00 2001 From: Steven Loria Date: Fri, 6 Dec 2013 19:07:58 -0600 Subject: [PATCH] Remove redundant form validation --- .../{{cookiecutter.repo_name}}/public/views.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/public/views.py b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/public/views.py index bf14a6f..875920e 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/public/views.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/public/views.py @@ -51,13 +51,10 @@ def register(): email=form.email.data, password=form.password.data, active=True) - try: - db.session.add(new_user) - db.session.commit() - flash("Thank you for registering. You can now log in.", 'success') - return redirect(url_for('public.home')) - except IntegrityError as err: - flash("That username and/or email already exists. Try again.", 'warning') + db.session.add(new_user) + db.session.commit() + flash("Thank you for registering. You can now log in.", 'success') + return redirect(url_for('public.home')) else: flash_errors(form) return render_template('public/register.html', form=form)