OLD | NEW |
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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 except urllib2.URLError, e: | 402 except urllib2.URLError, e: |
403 if retry >= (maxtries - 1): | 403 if retry >= (maxtries - 1): |
404 raise | 404 raise |
405 if (not 'Name or service not known' in e.reason and | 405 if (not 'Name or service not known' in e.reason and |
406 not 'EOF occurred in violation of protocol' in e.reason): | 406 not 'EOF occurred in violation of protocol' in e.reason): |
407 # Usually internal GAE flakiness. | 407 # Usually internal GAE flakiness. |
408 raise | 408 raise |
409 except ssl.SSLError, e: | 409 except ssl.SSLError, e: |
410 if retry >= (maxtries - 1): | 410 if retry >= (maxtries - 1): |
411 raise | 411 raise |
412 if not 'timed out' in e.reason: | 412 if not 'timed out' in str(e): |
413 raise | 413 raise |
414 # If reaching this line, loop again. Uses a small backoff. | 414 # If reaching this line, loop again. Uses a small backoff. |
415 time.sleep(1+maxtries*2) | 415 time.sleep(1+maxtries*2) |
416 finally: | 416 finally: |
417 upload.ErrorExit = old_error_exit | 417 upload.ErrorExit = old_error_exit |
418 | 418 |
419 # DEPRECATED. | 419 # DEPRECATED. |
420 Send = get | 420 Send = get |
421 | 421 |
422 | 422 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 | 536 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 |
537 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % | 537 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % |
538 (flag, value, issue)) | 538 (flag, value, issue)) |
539 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value | 539 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value |
540 | 540 |
541 def trigger_try_jobs( # pylint:disable=R0201 | 541 def trigger_try_jobs( # pylint:disable=R0201 |
542 self, issue, patchset, reason, clobber, revision, builders_and_tests): | 542 self, issue, patchset, reason, clobber, revision, builders_and_tests): |
543 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 543 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
544 (builders_and_tests, issue)) | 544 (builders_and_tests, issue)) |
OLD | NEW |