OLD | NEW |
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 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 def GetIssueDescription(self): | 392 def GetIssueDescription(self): |
393 """Returns the issue description from Rietveld.""" | 393 """Returns the issue description from Rietveld.""" |
394 return self.SendToRietveld('/%d/description' % self.issue) | 394 return self.SendToRietveld('/%d/description' % self.issue) |
395 | 395 |
396 def PrimeLint(self): | 396 def PrimeLint(self): |
397 """Do background work on Rietveld to lint the file so that the results are | 397 """Do background work on Rietveld to lint the file so that the results are |
398 ready when the issue is viewed.""" | 398 ready when the issue is viewed.""" |
399 if self.issue and self.patchset: | 399 if self.issue and self.patchset: |
400 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), | 400 self.SendToRietveld('/lint/issue%s_%s' % (self.issue, self.patchset), |
401 timeout=1) | 401 timeout=10) |
402 | 402 |
403 def SendToRietveld(self, request_path, timeout=None, **kwargs): | 403 def SendToRietveld(self, request_path, timeout=None, **kwargs): |
404 """Send a POST/GET to Rietveld. Returns the response body.""" | 404 """Send a POST/GET to Rietveld. Returns the response body.""" |
405 try: | 405 try: |
406 return self.RpcServer().Send(request_path, timeout=timeout, **kwargs) | 406 return self.RpcServer().Send(request_path, timeout=timeout, **kwargs) |
407 except urllib2.URLError: | 407 except urllib2.URLError: |
408 if timeout is None: | 408 if timeout is None: |
409 ErrorExit('Error accessing url %s' % request_path) | 409 ErrorExit('Error accessing url %s' % request_path) |
410 else: | 410 else: |
411 return None | 411 return None |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 raise | 1457 raise |
1458 print >> sys.stderr, ( | 1458 print >> sys.stderr, ( |
1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1460 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1460 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1461 return 1 | 1461 return 1 |
1462 | 1462 |
1463 | 1463 |
1464 if __name__ == "__main__": | 1464 if __name__ == "__main__": |
1465 fix_encoding.fix_encoding() | 1465 fix_encoding.fix_encoding() |
1466 sys.exit(main(sys.argv[1:])) | 1466 sys.exit(main(sys.argv[1:])) |
OLD | NEW |