Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
Use c.oauth2_client consistently
Browse files Browse the repository at this point in the history
Some cases were setting c.oauth_client instead of c.oauth2_client
  • Loading branch information
kemitche committed May 5, 2015
1 parent eb69c45 commit 7c31468
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion r2/r2/config/feature/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def current_subdomain(self):
return self.stacked_proxy_safe_get(c, 'subdomain')

def current_oauth_client(self):
client = self.stacked_proxy_safe_get(c, 'oauth_client', None)
client = self.stacked_proxy_safe_get(c, 'oauth2_client', None)
return getattr(client, '_id', None)

def is_admin(self, user):
Expand Down
4 changes: 2 additions & 2 deletions r2/r2/controllers/reddit_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ def run_sitewide_ratelimits(self):
if c.oauth_user and g.RL_OAUTH_SITEWIDE_ENABLED:
type_ = "oauth"
period = g.RL_OAUTH_RESET_SECONDS
max_reqs = c.oauth_client._max_reqs
max_reqs = c.oauth2_client._max_reqs
# Convert client_id to ascii str for use as memcache key
client_id = c.oauth2_access_token.client_id.encode("ascii")
# OAuth2 ratelimits are per user-app combination
Expand Down Expand Up @@ -1400,7 +1400,7 @@ def authenticate_with_token(self):
else:
c.user = UnloggedUser(get_browser_langs())
c.user_is_loggedin = False
c.oauth_client = OAuth2Client._byID(access_token.client_id)
c.oauth2_client = OAuth2Client._byID(access_token.client_id)
except RequirementException:
self._auth_error(401, "invalid_token")

Expand Down

0 comments on commit 7c31468

Please sign in to comment.