                      'Invalid access token: %s' % oauth_request.get_parameter('oauth_token'))
  
              try:
                  self.validate_token(request, consumer, token)
              except oauth2.Error, e:
                  print "got e"
                  raise exceptions.AuthenticationFailed(e.message)
  
              if not self.check_active(token.user):
                  raise exceptions.AuthenticationFailed('User not active: %s' % token.user.username)
  
 
</s> remove                 request.user = token.user
                return (request.user, None)
 </s> add                 return (token.user, token) </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         return store.check_nonce(request, oauth_request, oauth_request['oauth_nonce'])
 </s> add         return oauth_provider.store.store.check_nonce(request, oauth_request, oauth_request['oauth_nonce'])
            except oauth.Error, e:
                      'Invalid access token: %s' % oauth_request.get_parameter('oauth_token'))
  
              try:
                  self.validate_token(request, consumer, token)
            except oauth.Error, e:
            except oauth.Error, e:
                  raise exceptions.AuthenticationFailed(e.message)
  
              if not self.check_active(token.user):
                  raise exceptions.AuthenticationFailed('User not active: %s' % token.user.username)
  
keep keep keep keep replace 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