From 25d9aac016f50d3c01bb58ff478a2d68df3224f8 Mon Sep 17 00:00:00 2001 From: Elliott Jin Date: Sat, 18 Mar 2017 17:42:40 -0700 Subject: [PATCH] registration.py: Don't catch exception that can't be thrown. A previous commit changed a `get` (which can throw `DoesNotExist`) to use an existing object, but kept the `try` / `except` block: 4bf3ace4442b3b862c84a7490fcbdc6baef1ff88 Removing this unused code path allows us to achieve 100% test coverage. --- zerver/views/registration.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/zerver/views/registration.py b/zerver/views/registration.py index 14a39412d8..043f25b107 100644 --- a/zerver/views/registration.py +++ b/zerver/views/registration.py @@ -197,16 +197,10 @@ def accounts_register(request): # FIXME: sanitize email addresses and fullname if existing_user_profile is not None and existing_user_profile.is_mirror_dummy: - try: - user_profile = existing_user_profile - do_activate_user(user_profile) - do_change_password(user_profile, password) - do_change_full_name(user_profile, full_name) - except UserProfile.DoesNotExist: - user_profile = do_create_user(email, password, realm, full_name, short_name, - prereg_user=prereg_user, - tos_version=settings.TOS_VERSION, - newsletter_data={"IP": request.META['REMOTE_ADDR']}) + user_profile = existing_user_profile + do_activate_user(user_profile) + do_change_password(user_profile, password) + do_change_full_name(user_profile, full_name) else: user_profile = do_create_user(email, password, realm, full_name, short_name, prereg_user=prereg_user,