  
  
  class OAuthAuthentication(BaseAuthentication):
      """rest_framework OAuth authentication backend using
      django-oath-plus"""
      www_authenticate_realm = 'api'
      require_active = True
  
      def __init__(self, **kwargs):
          super(OAuthAuthentication, self).__init__(**kwargs)
 
</s> remove         if oauth2 is None:
            raise ImproperlyConfigured("The 'python-oauth2' package could not be imported. It is required for use with the 'OAuthAuthentication' class.")
 </s> add         if oauth is None:
            raise ImproperlyConfigured("The 'oauth2' package could not be imported. It is required for use with the 'OAuthAuthentication' class.") </s> remove from django.core.exceptions import ImproperlyConfigured
try:
    import oauth2
except ImportError:
    oauth2 = None

try:
    import oauth_provider
    from oauth_provider.store import store
except ImportError:
    oauth_provider = None

 </s> add  </s> remove         :returns: two-tuple of (user, auth) if authentication succeeds, or None otherwise.
 </s> add         Returns two-tuple of (user, auth token) if authentication succeeds, or None otherwise. </s> remove                 request.user = token.user
                return (request.user, None)
 </s> add                 return (token.user, token)
    django-oath-plus and oauth2"""
  
  
  class OAuthAuthentication(BaseAuthentication):
      """rest_framework OAuth authentication backend using
    django-oath-plus and oauth2"""
      www_authenticate_realm = 'api'
      require_active = True
  
      def __init__(self, **kwargs):
          super(OAuthAuthentication, self).__init__(**kwargs)
keep keep keep keep replace keep keep keep keep keep
 Move oauth2 and django-oauth-plus imports to compat and fix some minor issues

- alias oauth2 as oauth
- remove rouge print
- remove docstring markups
- OAuthAuthentication.authenticate() now returns (user, token) two-tuple on success
- don't set request.user because it's already set 
rest_framework/authentication.py