From 64f08550556a44eb75868168c6fcc8f0f1f49790 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Wed, 23 Jan 2013 18:41:17 -0500 Subject: [PATCH] Adding removed code from master rebase --- common/djangoapps/student/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 071a41a834..d9ead9c6fb 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -693,9 +693,15 @@ def create_exam_registration(request, post_override=None): course_id = post_vars['course_id'] course = (course_from_id(course_id)) # assume it will be found.... + # make sure that any demographic data values received from the page have been stripped. + # Whitespace is not an acceptable response for any of these values + demographic_data = {} + for fieldname in TestCenterUser.user_provided_fields(): + if fieldname in post_vars: + demographic_data[fieldname] = (post_vars[fieldname]).strip() try: testcenter_user = TestCenterUser.objects.get(user=user) - needs_updating = testcenter_user.needs_update(post_vars) + needs_updating = testcenter_user.needs_update(demographic_data) log.info("User {0} enrolled in course {1} {2}updating demographic info for exam registration".format(user.username, course_id, "" if needs_updating else "not ")) except TestCenterUser.DoesNotExist: # do additional initialization here: