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
c2a1870f
Commit
c2a1870f
authored
Apr 13, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean ID of course_module for push notification channel name.
Update Mobile API to include channel_id for course.
parent
a87c8810
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
common/lib/xmodule/xmodule/course_module.py
+10
-0
lms/djangoapps/mobile_api/users/serializers.py
+1
-0
lms/djangoapps/mobile_api/users/tests.py
+1
-0
lms/djangoapps/mobile_api/users/views.py
+1
-0
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
c2a1870f
...
@@ -10,6 +10,7 @@ import requests
...
@@ -10,6 +10,7 @@ import requests
from
datetime
import
datetime
from
datetime
import
datetime
import
dateutil.parser
import
dateutil.parser
from
lazy
import
lazy
from
lazy
import
lazy
from
base64
import
b32encode
from
xmodule.exceptions
import
UndefinedContext
from
xmodule.exceptions
import
UndefinedContext
from
xmodule.seq_module
import
SequenceDescriptor
,
SequenceModule
from
xmodule.seq_module
import
SequenceDescriptor
,
SequenceModule
...
@@ -1398,3 +1399,12 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
...
@@ -1398,3 +1399,12 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
self
.
video_upload_pipeline
is
not
None
and
self
.
video_upload_pipeline
is
not
None
and
'course_video_upload_token'
in
self
.
video_upload_pipeline
'course_video_upload_token'
in
self
.
video_upload_pipeline
)
)
def
clean_id
(
self
,
padding_char
=
'='
):
"""
Returns a unique deterministic base32-encoded ID for the course.
The optional padding_char parameter allows you to override the "=" character used for padding.
"""
return
"course_{}"
.
format
(
b32encode
(
unicode
(
self
.
location
.
course_key
))
.
replace
(
'='
,
padding_char
)
)
lms/djangoapps/mobile_api/users/serializers.py
View file @
c2a1870f
...
@@ -60,6 +60,7 @@ class CourseField(serializers.RelatedField):
...
@@ -60,6 +60,7 @@ class CourseField(serializers.RelatedField):
"course_updates"
:
course_updates_url
,
"course_updates"
:
course_updates_url
,
"course_handouts"
:
course_handouts_url
,
"course_handouts"
:
course_handouts_url
,
"course_about"
:
course_about_url
,
"course_about"
:
course_about_url
,
"subscription_id"
:
course
.
clean_id
(
padding_char
=
'_'
),
}
}
...
...
lms/djangoapps/mobile_api/users/tests.py
View file @
c2a1870f
...
@@ -60,6 +60,7 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin, MobileEn
...
@@ -60,6 +60,7 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin, MobileEn
self
.
assertTrue
(
'course_handouts'
in
found_course
)
self
.
assertTrue
(
'course_handouts'
in
found_course
)
self
.
assertEqual
(
found_course
[
'id'
],
unicode
(
self
.
course
.
id
))
self
.
assertEqual
(
found_course
[
'id'
],
unicode
(
self
.
course
.
id
))
self
.
assertEqual
(
courses
[
0
][
'mode'
],
'honor'
)
self
.
assertEqual
(
courses
[
0
][
'mode'
],
'honor'
)
self
.
assertEqual
(
courses
[
0
][
'course'
][
'subscription_id'
],
self
.
course
.
clean_id
(
padding_char
=
'_'
))
def
verify_failure
(
self
,
response
):
def
verify_failure
(
self
,
response
):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
lms/djangoapps/mobile_api/users/views.py
View file @
c2a1870f
...
@@ -221,6 +221,7 @@ class UserCourseEnrollmentsList(generics.ListAPIView):
...
@@ -221,6 +221,7 @@ class UserCourseEnrollmentsList(generics.ListAPIView):
* video_outline: The URI to get the list of all vides the user can
* video_outline: The URI to get the list of all vides the user can
access in the course.
access in the course.
* id: The unique ID of the course.
* id: The unique ID of the course.
* subscription_id: A unique "clean" (alphanumeric with '_') ID of the course.
* latest_updates: Reserved for future use.
* latest_updates: Reserved for future use.
* end: The end date of the course.
* end: The end date of the course.
* name: The name of the course.
* name: The name of the course.
...
...
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