Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
78bbaa02
Commit
78bbaa02
authored
11 years ago
by
Diana Huang
Browse files
Options
Downloads
Patches
Plain Diff
Add in human-readable text for error messages.
LMS-1133
parent
df20a102
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/verify_student/models.py
+13
-7
13 additions, 7 deletions
lms/djangoapps/verify_student/models.py
lms/djangoapps/verify_student/tests/test_models.py
+2
-2
2 additions, 2 deletions
lms/djangoapps/verify_student/tests/test_models.py
with
15 additions
and
9 deletions
lms/djangoapps/verify_student/models.py
+
13
−
7
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
):
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/verify_student/tests/test_models.py
+
2
−
2
View file @
78bbaa02
...
...
@@ -331,7 +331,7 @@ class TestPhotoVerification(TestCase):
attempt2
.
save
()
status
=
SoftwareSecurePhotoVerification
.
user_status
(
user
)
self
.
assertEquals
(
status
,
(
attempt2
.
status
,
"
P
hoto ID
Issues: Not
provided
"
))
self
.
assertEquals
(
status
,
(
attempt2
.
status
,
"
No p
hoto 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
(
"
P
hoto ID
Issues: Not
provided
"
,
parsed_error_msg
)
self
.
assertEquals
(
"
No p
hoto ID
was
provided
.
"
,
parsed_error_msg
)
def
test_parse_error_msg_failure
(
self
):
user
=
UserFactory
.
create
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment