  
  class BaseAuthenticator(object):
      """All authenticators should extend BaseAuthenticator."""
  
      def __init__(self, mixin):
          """Initialise the authenticator with the mixin instance as state,
          in case the authenticator needs to access any metadata on the mixin object."""
          self.mixin = mixin
  
      def authenticate(self, request):
 
</s> remove         self.mixin = mixin
 </s> add         self.view = view </s> remove         auth = self.auth
        for permitter_cls in self.permitters:
            permitter = permission_cls(self)
            permitter.permit(auth)
 </s> add         for permission_cls in self.permissions:
            permission = permission_cls(self)
            if not permission.has_permission(self.auth):
                raise ErrorResponse(status.HTTP_403_FORBIDDEN,
                                   {'detail': 'You do not have permission to access this resource. ' +
                                    'You may need to login or otherwise authenticate the request.'})                
 </s> remove     def _authenticate(self):
        for authenticator_cls in self.authenticators:
            authenticator = authenticator_cls(self)
            auth = authenticator.authenticate(self.request)
            if auth:
                return auth
        return None
 </s> add  </s> remove 
    def not_implemented(self, operation):
        """Return an HTTP 500 server error if an operation is called which has been allowed by
        allowed_methods, but which has not been implemented."""
        raise ErrorResponse(status.HTTP_500_INTERNAL_SERVER_ERROR,
                                {'detail': '%s operation on this resource has not been implemented' % (operation, )})


    def check_method_allowed(self, method, auth):
        """Ensure the request method is permitted for this resource, raising a ResourceException if it is not."""

        if not method in self.callmap.keys():
            raise ErrorResponse(status.HTTP_501_NOT_IMPLEMENTED,
                                    {'detail': 'Unknown or unsupported method \'%s\'' % method})

        if not method in self.allowed_methods:
            raise ErrorResponse(status.HTTP_405_METHOD_NOT_ALLOWED,
                                    {'detail': 'Method \'%s\' not allowed on this resource.' % method})

        if auth is None and not method in self.anon_allowed_methods:
            raise ErrorResponse(status.HTTP_403_FORBIDDEN,
                                    {'detail': 'You do not have permission to access this resource. ' +
                                     'You may need to login or otherwise authenticate the request.'})
 </s> add     def http_method_not_allowed(self, request, *args, **kwargs):
        """Return an HTTP 405 error if an operation is called which does not have a handler method."""
        raise ErrorResponse(status.HTTP_405_METHOD_NOT_ALLOWED,
                                {'detail': 'Method \'%s\' not allowed on this resource.' % self.method}) </s> remove             # Temporarily request.POST with .RAW_CONTENT, so that we use our more generic request parsing
            request._post = self.mixin.RAW_CONTENT
 </s> add             # Temporarily set request.POST to view.RAW_CONTENT,
            # so that we use our more generic request parsing,
            # in preference to Django's form-only request parsing.
            request._post = self.view.RAW_CONTENT
    def __init__(self, view):
  
  class BaseAuthenticator(object):
      """All authenticators should extend BaseAuthenticator."""
  
    def __init__(self, view):
          """Initialise the authenticator with the mixin instance as state,
          in case the authenticator needs to access any metadata on the mixin object."""
          self.mixin = mixin
  
      def authenticate(self, request):
keep keep keep keep replace keep keep keep keep keep
 Generic permissions added, allowed_methods and anon_allowed_methods now defunct, dispatch now mirrors View.dispatch more nicely 
djangorestframework/authenticators.py