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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 # How nice. | 378 # How nice. |
379 return result | 379 return result |
380 except urllib2.HTTPError, e: | 380 except urllib2.HTTPError, e: |
381 if retry >= (maxtries - 1): | 381 if retry >= (maxtries - 1): |
382 raise | 382 raise |
383 if e.code not in (500, 502, 503): | 383 if e.code not in (500, 502, 503): |
384 raise | 384 raise |
385 except urllib2.URLError, e: | 385 except urllib2.URLError, e: |
386 if retry >= (maxtries - 1): | 386 if retry >= (maxtries - 1): |
387 raise | 387 raise |
388 if not 'Name or service not known' in e.reason: | 388 if (not 'Name or service not known' in e.reason and |
| 389 not 'EOF occurred in violation of protocol' in e.reason): |
389 # Usually internal GAE flakiness. | 390 # Usually internal GAE flakiness. |
390 raise | 391 raise |
391 # If reaching this line, loop again. Uses a small backoff. | 392 # If reaching this line, loop again. Uses a small backoff. |
392 time.sleep(1+maxtries*2) | 393 time.sleep(1+maxtries*2) |
393 finally: | 394 finally: |
394 upload.ErrorExit = old_error_exit | 395 upload.ErrorExit = old_error_exit |
395 | 396 |
396 # DEPRECATED. | 397 # DEPRECATED. |
397 Send = get | 398 Send = get |
398 | 399 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 513 |
513 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 | 514 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 |
514 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % | 515 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % |
515 (flag, value, issue)) | 516 (flag, value, issue)) |
516 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value | 517 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value |
517 | 518 |
518 def trigger_try_jobs( # pylint:disable=R0201 | 519 def trigger_try_jobs( # pylint:disable=R0201 |
519 self, issue, patchset, reason, clobber, revision, builders_and_tests): | 520 self, issue, patchset, reason, clobber, revision, builders_and_tests): |
520 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 521 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
521 (builders_and_tests, issue)) | 522 (builders_and_tests, issue)) |
OLD | NEW |