Commit acce93e0 by Tim Babych

pep8

parent b75f00f1
from django.core.management.base import BaseCommand
from annotator.annotation import Annotation
class Command(BaseCommand):
help = 'Creates the mapping in the index.'
......
......@@ -5,9 +5,11 @@ from rest_framework.permissions import BasePermission
logger = logging.getLogger(__name__)
class TokenWrongIssuer(Exception):
pass
class HasAccessToken(BasePermission):
"""
Allow requests having valid ID Token.
......
......@@ -26,6 +26,7 @@ class MockAuthenticator(object):
def mock_authorizer(*args, **kwargs):
return True
def get_id_token(user):
now = datetime.utcnow()
return jwt.encode({
......@@ -33,4 +34,4 @@ def get_id_token(user):
'sub': user,
'iat': timegm(now.utctimetuple()),
'exp': timegm((now + timedelta(seconds=300)).utctimetuple()),
}, settings.CLIENT_SECRET)
\ No newline at end of file
}, settings.CLIENT_SECRET)
......@@ -36,7 +36,7 @@ class AnnotationSearchView(APIView):
if 'limit' in params and _convert_to_int(params['limit']) is not None:
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')
kwargs['limit'] = settings.RESULTS_DEFAULT_SIZE
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment