Closed justinabrahms closed 8 years ago
There's a edge case here, from webpack.py
:
try:
email = request.user.email
name = request.user.userinfo.full_name
except (AttributeError, ObjectDoesNotExist):
# AnonymousUser doesn't have an email address
# or incorrectly built user, as it lacks a userinfo property.
email = ""
name = ""
If the user lacks a userinfo object we should still get their email address, though this is not critical as it's just used to inform Stripe so it can prepopulate the email in the form
Updated with tests and suggested improvement.
Looks good :+1:
What are the relevant tickets?
Fixes #406
What's this PR do?
Wraps guards around times we expect to have userinfo objects and raises a validation error if it doesn't.
Where should the reviewer start?
checkout.py
How should this be manually tested?
Create a superuser. Go do TP things (view courses, etc) and you shouldn't get 500s.
Any background context you want to provide?
Screenshots (if appropriate)
What GIF best describes this PR or how it makes you feel?