Commit acce93e0 by Tim Babych

pep8

parent b75f00f1
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.'
......
...@@ -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.
......
...@@ -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
...@@ -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:
......
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