Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-notes-api
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-notes-api
Commits
acce93e0
Commit
acce93e0
authored
Dec 03, 2014
by
Tim Babych
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8
parent
b75f00f1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
4 deletions
+6
-4
notesapi/__init__.py
+0
-1
notesapi/management/commands/create_index.py
+1
-0
notesapi/v1/permissions.py
+2
-0
notesapi/v1/tests/helpers.py
+2
-2
notesapi/v1/views.py
+1
-1
No files found.
notesapi/__init__.py
View file @
acce93e0
notesapi/management/commands/create_index.py
View file @
acce93e0
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
from
annotator.annotation
import
Annotation
from
annotator.annotation
import
Annotation
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
help
=
'Creates the mapping in the index.'
help
=
'Creates the mapping in the index.'
...
...
notesapi/v1/permissions.py
View file @
acce93e0
...
@@ -5,9 +5,11 @@ from rest_framework.permissions import BasePermission
...
@@ -5,9 +5,11 @@ from rest_framework.permissions import BasePermission
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
class
TokenWrongIssuer
(
Exception
):
class
TokenWrongIssuer
(
Exception
):
pass
pass
class
HasAccessToken
(
BasePermission
):
class
HasAccessToken
(
BasePermission
):
"""
"""
Allow requests having valid ID Token.
Allow requests having valid ID Token.
...
...
notesapi/v1/tests/helpers.py
View file @
acce93e0
...
@@ -26,6 +26,7 @@ class MockAuthenticator(object):
...
@@ -26,6 +26,7 @@ class MockAuthenticator(object):
def
mock_authorizer
(
*
args
,
**
kwargs
):
def
mock_authorizer
(
*
args
,
**
kwargs
):
return
True
return
True
def
get_id_token
(
user
):
def
get_id_token
(
user
):
now
=
datetime
.
utcnow
()
now
=
datetime
.
utcnow
()
return
jwt
.
encode
({
return
jwt
.
encode
({
...
@@ -33,4 +34,4 @@ def get_id_token(user):
...
@@ -33,4 +34,4 @@ def get_id_token(user):
'sub'
:
user
,
'sub'
:
user
,
'iat'
:
timegm
(
now
.
utctimetuple
()),
'iat'
:
timegm
(
now
.
utctimetuple
()),
'exp'
:
timegm
((
now
+
timedelta
(
seconds
=
300
))
.
utctimetuple
()),
'exp'
:
timegm
((
now
+
timedelta
(
seconds
=
300
))
.
utctimetuple
()),
},
settings
.
CLIENT_SECRET
)
},
settings
.
CLIENT_SECRET
)
\ No newline at end of file
notesapi/v1/views.py
View file @
acce93e0
...
@@ -36,7 +36,7 @@ class AnnotationSearchView(APIView):
...
@@ -36,7 +36,7 @@ class AnnotationSearchView(APIView):
if
'limit'
in
params
and
_convert_to_int
(
params
[
'limit'
])
is
not
None
:
if
'limit'
in
params
and
_convert_to_int
(
params
[
'limit'
])
is
not
None
:
kwargs
[
'limit'
]
=
_convert_to_int
(
params
.
pop
(
'limit'
))
kwargs
[
'limit'
]
=
_convert_to_int
(
params
.
pop
(
'limit'
))
elif
'limit'
in
params
and
_convert_to_int
(
params
[
'limit'
])
is
None
:
# bad value
elif
'limit'
in
params
and
_convert_to_int
(
params
[
'limit'
])
is
None
:
# bad value
params
.
pop
(
'limit'
)
params
.
pop
(
'limit'
)
kwargs
[
'limit'
]
=
settings
.
RESULTS_DEFAULT_SIZE
kwargs
[
'limit'
]
=
settings
.
RESULTS_DEFAULT_SIZE
else
:
else
:
...
...
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