Skip to content

Commit

Permalink
registration.py: Don't catch exception that can't be thrown.
Browse files Browse the repository at this point in the history
A previous commit changed a `get` (which can throw `DoesNotExist`) to use an
existing object, but kept the `try` / `except` block:

4bf3ace

Removing this unused code path allows us to achieve 100% test coverage.
  • Loading branch information
robot-dreams authored and timabbott committed Mar 19, 2017
1 parent 8cfc231 commit 25d9aac
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions zerver/views/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 25d9aac

Please sign in to comment.