aed81ab621abf2bc6fc10be4b1b42c932750490f,accounts/views.py,,account,#Any#Any#,800
Before Change
def account(request, username):
try:
user = User.objects.select_related("profile").get(username__iexact=username)
except User.DoesNotExist:
try:
old_username = OldUsername.objects.get(username__iexact=username)
return HttpResponsePermanentRedirect(reverse("account", args=[old_username.user.username]))
except OldUsername.DoesNotExist:
raise Http404
tags = user.profile.get_user_tags() if user.profile else []
latest_sounds = list(Sound.objects.bulk_sounds_for_user(user.id, settings.SOUNDS_PER_PAGE))
latest_packs = Pack.objects.select_related().filter(user=user, num_sounds__gt=0).exclude(is_deleted=True) \
.order_by("-last_updated")[0:10]
After Change
def account(request, username):
user = get_user_from_oldusername(username)
if user == None:
raise Http404
elif user.username != username:
return HttpResponsePermanentRedirect(reverse("account", args=[user.username]))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: MTG/freesound
Commit Name: aed81ab621abf2bc6fc10be4b1b42c932750490f
Time: 2018-01-05
Author: andres.ferraro@upf.edu
File Name: accounts/views.py
Class Name:
Method Name: account
Project Name: MTG/freesound
Commit Name: aed81ab621abf2bc6fc10be4b1b42c932750490f
Time: 2018-01-05
Author: andres.ferraro@upf.edu
File Name: geotags/views.py
Class Name:
Method Name: for_user
Project Name: MTG/freesound
Commit Name: aed81ab621abf2bc6fc10be4b1b42c932750490f
Time: 2018-01-05
Author: andres.ferraro@upf.edu
File Name: accounts/views.py
Class Name:
Method Name: check_username