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
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
92d10ebd
Commit
92d10ebd
authored
10 years ago
by
Will Daly
Browse files
Options
Downloads
Patches
Plain Diff
Respond to code review feedback
parent
83f8de6c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/djangoapps/enrollment/api.py
+13
-5
13 additions, 5 deletions
common/djangoapps/enrollment/api.py
with
13 additions
and
5 deletions
common/djangoapps/enrollment/api.py
+
13
−
5
View file @
92d10ebd
...
...
@@ -46,7 +46,7 @@ def get_enrollments(student_id):
in the the course.
Args:
student_id (str): The
ID
of the student we want to retrieve course enrollment information for.
student_id (str): The
username
of the student we want to retrieve course enrollment information for.
Returns:
A list of enrollment information for the given student.
...
...
@@ -354,11 +354,18 @@ def _validate_course_mode(course_id, mode):
"""
course_enrollment_info
=
_data_api
().
get_course_enrollment_info
(
course_id
)
course_modes
=
course_enrollment_info
[
"
course_modes
"
]
if
mode
not
in
(
mode
[
'
slug
'
]
for
mode
in
course_modes
):
msg
=
u
"
Specified course mode unavailable for course {course_id}
"
.
format
(
course_id
=
course_id
)
available_modes
=
[
m
[
'
slug
'
]
for
m
in
course_modes
]
if
mode
not
in
available_modes
:
msg
=
(
u
"
Specified course mode
'
{mode}
'
unavailable for course {course_id}.
"
u
"
Available modes were: {available}
"
).
format
(
mode
=
mode
,
course_id
=
course_id
,
available
=
"
,
"
.
join
(
available_modes
)
)
log
.
warn
(
msg
)
error
=
CourseModeNotFoundError
(
msg
,
course_enrollment_info
)
raise
error
raise
CourseModeNotFoundError
(
msg
,
course_enrollment_info
)
def
_data_api
():
...
...
@@ -374,4 +381,5 @@ def _data_api():
try
:
return
importlib
.
import_module
(
api_path
)
except
(
ImportError
,
ValueError
):
log
.
exception
(
u
"
Could not load module at
'
{path}
'"
.
format
(
path
=
api_path
))
raise
EnrollmentApiLoadError
(
api_path
)
This diff is collapsed.
Click to expand it.
Preview
0%
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