Skip to content

Commit

Permalink
#209 another test run...
Browse files Browse the repository at this point in the history
  • Loading branch information
tonylampada committed Aug 31, 2014
1 parent 9c334ec commit 0288bab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions djangoproject/core/management/commands/screen2username.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ def _user_with_same_screenName_already(user, screenName, new_username):
_set_username(user, new_username)
subject = 'Important information about your account on FreedomSponsors'
_template_render_and_send(subject, BODY_USER_WITH_SAME_SCREENNAME, user, screenName, new_username)
print('SAME,%s,%s,%s,%s,%s,%s' % (user.id, user.email, screenName, slugify(screenName), user.username, new_username))
print('SAME_SCREENNAME,%s,%s,%s,%s,%s,%s' % (user.id, user.email, screenName, slugify(screenName), user.username, new_username))


def _user_with_same_username_already(user, screenName, new_username):
print('SAME_USERNAME,%s,%s,%s,%s,%s,%s' % (user.id, user.email, screenName, slugify(screenName), user.username, new_username))


def _user_with_invalid_screenName(user, screenName, new_username):
Expand Down Expand Up @@ -167,6 +171,7 @@ class Command(NoArgsCommand):
)

def handle_noargs(self, **options):
print('TYPE,id,email,screenName,slugify(screenName),old_username,new_username')
for user in User.objects.all().order_by('id'):
# for user in User.objects.filter(id__le=20).order_by('id'):
userinfo = user.getUserInfo()
Expand All @@ -178,7 +183,9 @@ def handle_noargs(self, **options):
if has_password:
_user_with_password(user, screenName, new_username)
elif new_is_valid:
if screenName == new_username:
if new_username == user.username:
_user_with_same_username_already(user, screenName, new_username)
elif screenName == new_username:
_user_with_same_screenName_already(user, screenName, new_username)
else:
new_username = _make_available(new_username)
Expand Down

0 comments on commit 0288bab

Please sign in to comment.