From e6fef7d7ba5fc3b10308aefac8fd41b479028f88 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 13 Dec 2012 09:11:17 -0500 Subject: [PATCH] Fix confusion of user / user_profile objects in MIT signup codepaths. (imported from commit f39943bf31f705365ed9743c6d2e9239fed8c9e2) --- zephyr/views.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/zephyr/views.py b/zephyr/views.py index 6d634a59ad..6fb3e961b2 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -63,7 +63,7 @@ def get_stream(stream_name, realm): except Stream.DoesNotExist: return None -def notify_new_user(user, internal=False): +def notify_new_user(user_profile, internal=False): if internal: # When this is done using manage.py vs. the web interface internal_blurb = " **INTERNAL SIGNUP** " @@ -71,12 +71,13 @@ def notify_new_user(user, internal=False): internal_blurb = " " internal_send_message("humbug+signups@humbughq.com", - Recipient.STREAM, "signups", user.realm.domain, + Recipient.STREAM, "signups", user_profile.realm.domain, "%s <`%s`> just signed up for Humbug!%s(total: **%i**)" % ( - user.full_name, - user.user.email, + user_profile.full_name, + user_profile.user.email, internal_blurb, - UserProfile.objects.filter(realm=user.realm, user__is_active=True).count(), + UserProfile.objects.filter(realm=user_profile.realm, + user__is_active=True).count(), ) ) @@ -115,12 +116,13 @@ def accounts_register(request): user = User.objects.get(email=email) do_activate_user(user) do_change_password(user, password) - do_change_full_name(user.userprofile, full_name) + user_profile = user.userprofile + do_change_full_name(user_profile, full_name) else: - user = do_create_user(email, password, realm, full_name, short_name) - add_default_subs(user) + user_profile = do_create_user(email, password, realm, full_name, short_name) + add_default_subs(user_profile) - notify_new_user(user) + notify_new_user(user_profile) login(request, authenticate(username=email, password=password)) return HttpResponseRedirect(reverse('zephyr.views.home'))