Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Unified Diff: rietveld.py

Issue 1075723002: Extract authentication options handling into a separate function. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_support.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rietveld.py
diff --git a/rietveld.py b/rietveld.py
index f3bcd718d318e5f95f46c327c8a4d6ebe85686ac..0114cfe0ccee6bf9922c03f9c8575191484ef06b 100644
--- a/rietveld.py
+++ b/rietveld.py
@@ -37,27 +37,10 @@ upload.LOGGER.setLevel(logging.WARNING) # pylint: disable=E1103
class Rietveld(object):
"""Accesses rietveld."""
- def __init__(self, url, email, password, extra_headers=None, maxtries=None):
+ def __init__(
+ self, url, auth_config, email=None, extra_headers=None, maxtries=None):
self.url = url.rstrip('/')
-
- # TODO(maruel): It's not awesome but maybe necessary to retrieve the value.
- # It happens when the presubmit check is ran out of process, the cookie
- # needed to be recreated from the credentials. Instead, it should pass the
- # email and the cookie.
- if email and password:
- get_creds = lambda: (email, password)
- self.rpc_server = upload.HttpRpcServer(
- self.url,
- get_creds,
- extra_headers=extra_headers or {})
- else:
- if email == '':
- # If email is given as an empty string, then assume we want to make
- # requests that do not need authentication. Bypass authentication by
- # setting the auth_function to None.
- self.rpc_server = upload.HttpRpcServer(url, None)
- else:
- self.rpc_server = upload.GetRpcServer(url, email)
+ self.rpc_server = upload.GetRpcServer(self.url, auth_config, email)
self._xsrf_token = None
self._xsrf_token_time = None
« no previous file with comments | « presubmit_support.py ('k') | tests/gcl_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698