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

Side by Side Diff: rietveld.py

Issue 20634003: Add anonymous-only option to apply_issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: use --no-auth Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « apply_issue.py ('k') | third_party/upload.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """Defines class Rietveld to easily access a rietveld instance. 5 """Defines class Rietveld to easily access a rietveld instance.
6 6
7 Security implications: 7 Security implications:
8 8
9 The following hypothesis are made: 9 The following hypothesis are made:
10 - Rietveld enforces: 10 - Rietveld enforces:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if email and password: 43 if email and password:
44 get_creds = lambda: (email, password) 44 get_creds = lambda: (email, password)
45 self.rpc_server = upload.HttpRpcServer( 45 self.rpc_server = upload.HttpRpcServer(
46 self.url, 46 self.url,
47 get_creds, 47 get_creds,
48 extra_headers=extra_headers or {}) 48 extra_headers=extra_headers or {})
49 else: 49 else:
50 if email == '': 50 if email == '':
51 # If email is given as an empty string, then assume we want to make 51 # If email is given as an empty string, then assume we want to make
52 # requests that do not need authentication. Bypass authentication by 52 # requests that do not need authentication. Bypass authentication by
53 # setting the flag to True. 53 # setting the auth_function to None.
54 get_creds = lambda: (email, None) 54 self.rpc_server = upload.HttpRpcServer(url, None)
55 self.rpc_server = upload.HttpRpcServer(url, get_creds)
56 self.rpc_server.authenticated = True
57 else: 55 else:
58 self.rpc_server = upload.GetRpcServer(url, email) 56 self.rpc_server = upload.GetRpcServer(url, email)
59 57
60 self._xsrf_token = None 58 self._xsrf_token = None
61 self._xsrf_token_time = None 59 self._xsrf_token_time = None
62 60
63 def xsrf_token(self): 61 def xsrf_token(self):
64 if (not self._xsrf_token_time or 62 if (not self._xsrf_token_time or
65 (time.time() - self._xsrf_token_time) > 30*60): 63 (time.time() - self._xsrf_token_time) > 30*60):
66 self._xsrf_token_time = time.time() 64 self._xsrf_token_time = time.time()
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 if not messages: 443 if not messages:
446 # Assumes self._lookup uses deepcopy. 444 # Assumes self._lookup uses deepcopy.
447 del data['messages'] 445 del data['messages']
448 return data 446 return data
449 447
450 def get_patchset_properties(self, issue, patchset): 448 def get_patchset_properties(self, issue, patchset):
451 return self._lookup( 449 return self._lookup(
452 'get_patchset_properties', 450 'get_patchset_properties',
453 (issue, patchset), 451 (issue, patchset),
454 super(CachingRietveld, self).get_patchset_properties) 452 super(CachingRietveld, self).get_patchset_properties)
OLDNEW
« no previous file with comments | « apply_issue.py ('k') | third_party/upload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698