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
92d10ebd
Commit
92d10ebd
authored
Nov 17, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respond to code review feedback
parent
83f8de6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
common/djangoapps/enrollment/api.py
+13
-5
No files found.
common/djangoapps/enrollment/api.py
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
)
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