mattdrayer/increment-edx-lint: Bump to v0.2.9 and address pylint/pep8 violations
* Fix paver violations to stablize edx-lint update * Parens, Line2Long * Fix missing docstrings * Fix PEP8 issues * Address PR feedback (thanks @nedbat!)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Custom Django REST Framework request/response pipeline parsers
|
||||
"""
|
||||
from rest_framework import parsers
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""
|
||||
API library for Django REST Framework permissions-oriented workflows
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
from rest_framework import permissions
|
||||
from django.http import Http404
|
||||
@@ -6,6 +10,9 @@ from student.roles import CourseStaffRole
|
||||
|
||||
|
||||
class ApiKeyHeaderPermission(permissions.BasePermission):
|
||||
"""
|
||||
Django REST Framework permissions class used to manage API Key integrations
|
||||
"""
|
||||
def has_permission(self, request, view):
|
||||
"""
|
||||
Check for permissions by matching the configured API key and header
|
||||
|
||||
@@ -24,7 +24,6 @@ from openedx.core.lib.api.authentication import (
|
||||
OAuth2AuthenticationAllowInactiveUser,
|
||||
)
|
||||
from openedx.core.lib.api.permissions import IsUserInUrl
|
||||
from util.milestones_helpers import any_unfulfilled_milestones
|
||||
|
||||
|
||||
class DeveloperErrorViewMixin(object):
|
||||
@@ -63,6 +62,10 @@ class DeveloperErrorViewMixin(object):
|
||||
return self.make_error_response(400, validation_error.messages[0])
|
||||
|
||||
def handle_exception(self, exc):
|
||||
"""
|
||||
Generalized helper method for managing specific API exception workflows
|
||||
"""
|
||||
|
||||
if isinstance(exc, APIException):
|
||||
return self.make_error_response(exc.status_code, exc.detail)
|
||||
elif isinstance(exc, Http404):
|
||||
|
||||
Reference in New Issue
Block a user