Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
78bbaa02
Commit
78bbaa02
authored
Oct 29, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in human-readable text for error messages.
LMS-1133
parent
df20a102
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
lms/djangoapps/verify_student/models.py
+13
-7
lms/djangoapps/verify_student/tests/test_models.py
+2
-2
No files found.
lms/djangoapps/verify_student/models.py
View file @
78bbaa02
...
...
@@ -534,10 +534,14 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
Returns a list of error messages
"""
# Translates the category names into something more human readable
category_dict
=
{
"photoIdReasons"
:
_
(
"Photo ID Issues: "
),
"generalReasons"
:
u""
# Translates the category names and messages into something more human readable
message_dict
=
{
(
"photoIdReasons"
,
"Not provided"
):
_
(
"No photo ID was provided."
),
(
"photoIdReasons"
,
"Text not clear"
):
_
(
"The text in your photo ID image was not clear."
),
(
"generalReasons"
,
"Name mismatch"
):
_
(
"The name associated with your account and the name on your ID do not match."
),
(
"generalReasons"
,
"Expected name missing"
):
_
(
"We were unable to send your name along with your photo."
),
(
"userPhotoReasons"
,
"Image not clear"
):
_
(
"The image of your face was not clear."
),
(
"userPhotoReasons"
,
"Face out of view"
):
_
(
"Your face was not in view for your face photo"
),
}
try
:
...
...
@@ -546,13 +550,15 @@ class SoftwareSecurePhotoVerification(PhotoVerification):
msg
=
[]
for
category
in
msg_dict
:
# translate the category into a human-readable name
category_name
=
category_dict
[
category
]
msg
.
append
(
category_name
+
u", "
.
join
(
msg_dict
[
category
]))
# find the messages associated with this category
category_msgs
=
msg_dict
[
category
]
for
category_msg
in
category_msgs
:
msg
.
append
(
message_dict
[(
category
,
category_msg
)])
return
u", "
.
join
(
msg
)
except
(
ValueError
,
KeyError
):
# if we can't parse the message as JSON or the category doesn't
# match one of our known categories, show a generic error
log
.
error
(
'PhotoVerification: Error parsing this error message:
%
s'
,
self
.
error_msg
)
return
_
(
"There was an error verifying your ID photos."
)
def
image_url
(
self
,
name
):
...
...
lms/djangoapps/verify_student/tests/test_models.py
View file @
78bbaa02
...
...
@@ -331,7 +331,7 @@ class TestPhotoVerification(TestCase):
attempt2
.
save
()
status
=
SoftwareSecurePhotoVerification
.
user_status
(
user
)
self
.
assertEquals
(
status
,
(
attempt2
.
status
,
"
Photo ID Issues: Not provided
"
))
self
.
assertEquals
(
status
,
(
attempt2
.
status
,
"
No photo ID was provided.
"
))
def
test_parse_error_msg_success
(
self
):
user
=
UserFactory
.
create
()
...
...
@@ -339,7 +339,7 @@ class TestPhotoVerification(TestCase):
attempt
.
status
=
'denied'
attempt
.
error_msg
=
'[{"photoIdReasons": ["Not provided"]}]'
parsed_error_msg
=
attempt
.
parse_error_msg
()
self
.
assertEquals
(
"
Photo ID Issues: Not provided
"
,
parsed_error_msg
)
self
.
assertEquals
(
"
No photo ID was provided.
"
,
parsed_error_msg
)
def
test_parse_error_msg_failure
(
self
):
user
=
UserFactory
.
create
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment