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

Side by Side Diff: my_activity.py

Issue 68763004: my_activity: Skip Rietveld cookie check if not found. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
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 5
6 """Get stats about your activity. 6 """Get stats about your activity.
7 7
8 Example: 8 Example:
9 - my_activity.py for stats for the current week (last week on mondays). 9 - my_activity.py for stats for the current week (last week on mondays).
10 - my_activity.py -Q for stats for last quarter. 10 - my_activity.py -Q for stats for last quarter.
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 self.check_cookies() 270 self.check_cookies()
271 self.google_code_auth_token = None 271 self.google_code_auth_token = None
272 self.webkit_repo = options.webkit_repo 272 self.webkit_repo = options.webkit_repo
273 if self.webkit_repo: 273 if self.webkit_repo:
274 self.setup_webkit_info() 274 self.setup_webkit_info()
275 275
276 # Check the codereview cookie jar to determine which Rietveld instances to 276 # Check the codereview cookie jar to determine which Rietveld instances to
277 # authenticate to. 277 # authenticate to.
278 def check_cookies(self): 278 def check_cookies(self):
279 cookie_file = os.path.expanduser('~/.codereview_upload_cookies') 279 cookie_file = os.path.expanduser('~/.codereview_upload_cookies')
280 cookie_jar = cookielib.MozillaCookieJar(cookie_file)
281 if not os.path.exists(cookie_file): 280 if not os.path.exists(cookie_file):
282 exit(1) 281 print 'No Rietveld cookie file found.'
283 282 cookie_jar = []
284 try: 283 else:
285 cookie_jar.load() 284 cookie_jar = cookielib.MozillaCookieJar(cookie_file)
286 print 'Found cookie file: %s' % cookie_file 285 try:
287 except (cookielib.LoadError, IOError): 286 cookie_jar.load()
288 exit(1) 287 print 'Found cookie file: %s' % cookie_file
288 except (cookielib.LoadError, IOError):
289 print 'Error loading Rietveld cookie file: %s' % cookie_file
290 cookie_jar = []
289 291
290 filtered_instances = [] 292 filtered_instances = []
291 293
292 def has_cookie(instance): 294 def has_cookie(instance):
293 for cookie in cookie_jar: 295 for cookie in cookie_jar:
294 if cookie.name == 'SACSID' and cookie.domain == instance['url']: 296 if cookie.name == 'SACSID' and cookie.domain == instance['url']:
295 return True 297 return True
296 if self.options.auth: 298 if self.options.auth:
297 return get_yes_or_no('No cookie found for %s. Authorize for this ' 299 return get_yes_or_no('No cookie found for %s. Authorize for this '
298 'instance? (may require application-specific ' 300 'instance? (may require application-specific '
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 print '\n\n\n' 1096 print '\n\n\n'
1095 1097
1096 my_activity.print_changes() 1098 my_activity.print_changes()
1097 my_activity.print_reviews() 1099 my_activity.print_reviews()
1098 my_activity.print_issues() 1100 my_activity.print_issues()
1099 return 0 1101 return 0
1100 1102
1101 1103
1102 if __name__ == '__main__': 1104 if __name__ == '__main__':
1103 sys.exit(main()) 1105 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698