From dd8aba8fc927b42f54b6976e530a95d97fc3188e Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Sat, 21 Mar 2015 09:23:27 -0400 Subject: [PATCH] Fixes merge conflict with account creation transaction. --- common/djangoapps/student/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 74c6989997..b3f76781a0 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -1392,8 +1392,6 @@ def _do_create_account(form): log.exception("UserProfile creation failed for user {id}.".format(id=user.id)) raise - preferences_api.set_user_preference(user, LANGUAGE_KEY, get_language()) - return (user, profile, registration) @@ -1472,6 +1470,7 @@ def create_account_with_params(request, params): tos_required=tos_required, ) + # Perform operations within a transaction that are critical to account creation with transaction.commit_on_success(): # first, create the account (user, profile, registration) = _do_create_account(form) @@ -1502,6 +1501,9 @@ def create_account_with_params(request, params): request.social_strategy.clean_partial_pipeline() raise ValidationError({'access_token': [error_message]}) + # Perform operations that are non-critical parts of account creation + preferences_api.set_user_preference(user, LANGUAGE_KEY, get_language()) + if settings.FEATURES.get('ENABLE_DISCUSSION_EMAIL_DIGEST'): try: enable_notifications(user)