| OLD | NEW | 
|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be | 
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. | 
| 4 """Defines class Rietveld to easily access a rietveld instance. | 4 """Defines class Rietveld to easily access a rietveld instance. | 
| 5 | 5 | 
| 6 Security implications: | 6 Security implications: | 
| 7 | 7 | 
| 8 The following hypothesis are made: | 8 The following hypothesis are made: | 
| 9 - Rietveld enforces: | 9 - Rietveld enforces: | 
| 10   - Nobody else than issue owner can upload a patch set | 10   - Nobody else than issue owner can upload a patch set | 
| 11   - Verifies the issue owner credentials when creating new issues | 11   - Verifies the issue owner credentials when creating new issues | 
| 12   - A issue owner can't change once the issue is created | 12   - A issue owner can't change once the issue is created | 
| 13   - A patch set cannot be modified | 13   - A patch set cannot be modified | 
| 14 """ | 14 """ | 
| 15 | 15 | 
|  | 16 import json | 
| 16 import logging | 17 import logging | 
| 17 import os |  | 
| 18 import re | 18 import re | 
| 19 import sys |  | 
| 20 import time | 19 import time | 
| 21 import urllib2 | 20 import urllib2 | 
| 22 | 21 | 
| 23 try: |  | 
| 24   import simplejson as json  # pylint: disable=F0401 |  | 
| 25 except ImportError: |  | 
| 26   try: |  | 
| 27     import json  # pylint: disable=F0401 |  | 
| 28   except ImportError: |  | 
| 29     # Import the one included in depot_tools. |  | 
| 30     sys.path.append(os.path.join(os.path.dirname(__file__), 'third_party')) |  | 
| 31     import simplejson as json  # pylint: disable=F0401 |  | 
| 32 |  | 
| 33 from third_party import upload | 22 from third_party import upload | 
| 34 import patch | 23 import patch | 
| 35 | 24 | 
| 36 # Hack out upload logging.info() | 25 # Hack out upload logging.info() | 
| 37 upload.logging = logging.getLogger('upload') | 26 upload.logging = logging.getLogger('upload') | 
| 38 # Mac pylint choke on this line. | 27 # Mac pylint choke on this line. | 
| 39 upload.logging.setLevel(logging.WARNING)  # pylint: disable=E1103 | 28 upload.logging.setLevel(logging.WARNING)  # pylint: disable=E1103 | 
| 40 | 29 | 
| 41 | 30 | 
| 42 class Rietveld(object): | 31 class Rietveld(object): | 
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 343           if not 'Name or service not known' in e.reason: | 332           if not 'Name or service not known' in e.reason: | 
| 344             # Usually internal GAE flakiness. | 333             # Usually internal GAE flakiness. | 
| 345             raise | 334             raise | 
| 346         # If reaching this line, loop again. Uses a small backoff. | 335         # If reaching this line, loop again. Uses a small backoff. | 
| 347         time.sleep(1+maxtries*2) | 336         time.sleep(1+maxtries*2) | 
| 348     finally: | 337     finally: | 
| 349       upload.ErrorExit = old_error_exit | 338       upload.ErrorExit = old_error_exit | 
| 350 | 339 | 
| 351   # DEPRECATED. | 340   # DEPRECATED. | 
| 352   Send = get | 341   Send = get | 
| OLD | NEW | 
|---|