From 8aee486f6396a0dcd54f173f630bf1ea7646b7eb Mon Sep 17 00:00:00 2001 From: "deymo@chromium.org" Date: Wed, 13 Nov 2013 19:33:27 +0000 Subject: [PATCH] my_activity: Skip Rietveld cookie check if not found. ChromiumOS only developers don't always have a Chromium checkout and a Rietveld cookie file (~/.codereview_upload_cookies) with the auth keys. This patch proceeds with the activity lookup from other services such as Gerrit and GoB if there's no Rietveld cookie present, displaying an error message when this happens. BUG=chromium:316961 TEST=Remove ~/.codereview_upload_cookies and ran my_activity. ChromeOS activity listed. Review URL: https://codereview.chromium.org/68763004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@234874 0039d316-1c4b-4281-b951-d872f2087c98 --- my_activity.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/my_activity.py b/my_activity.py index 09dc0fb3c..d8a093a81 100755 --- a/my_activity.py +++ b/my_activity.py @@ -277,15 +277,17 @@ class MyActivity(object): # authenticate to. def check_cookies(self): cookie_file = os.path.expanduser('~/.codereview_upload_cookies') - cookie_jar = cookielib.MozillaCookieJar(cookie_file) if not os.path.exists(cookie_file): - exit(1) - - try: - cookie_jar.load() - print 'Found cookie file: %s' % cookie_file - except (cookielib.LoadError, IOError): - exit(1) + print 'No Rietveld cookie file found.' + cookie_jar = [] + else: + cookie_jar = cookielib.MozillaCookieJar(cookie_file) + try: + cookie_jar.load() + print 'Found cookie file: %s' % cookie_file + except (cookielib.LoadError, IOError): + print 'Error loading Rietveld cookie file: %s' % cookie_file + cookie_jar = [] filtered_instances = []