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:
Matt Drayer
2015-10-14 10:42:36 -04:00
parent d7c8cb803a
commit 1eab25f292
70 changed files with 614 additions and 169 deletions

View File

@@ -1,3 +1,6 @@
"""
Custom Django REST Framework request/response pipeline parsers
"""
from rest_framework import parsers

View File

@@ -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

View File

@@ -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):