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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 """Closes the Rietveld issue for this changelist.""" | 79 """Closes the Rietveld issue for this changelist.""" |
80 logging.info('closing issue %d' % issue) | 80 logging.info('closing issue %d' % issue) |
81 self.post("/%d/close" % issue, [('xsrf_token', self.xsrf_token())]) | 81 self.post("/%d/close" % issue, [('xsrf_token', self.xsrf_token())]) |
82 | 82 |
83 def get_description(self, issue): | 83 def get_description(self, issue): |
84 """Returns the issue's description.""" | 84 """Returns the issue's description.""" |
85 return self.get('/%d/description' % issue) | 85 return self.get('/%d/description' % issue) |
86 | 86 |
87 def get_issue_properties(self, issue, messages): | 87 def get_issue_properties(self, issue, messages): |
88 """Returns all the issue's metadata as a dictionary.""" | 88 """Returns all the issue's metadata as a dictionary.""" |
89 url = '/api/%d' % issue | 89 url = '/api/%s' % issue |
M-A Ruel
2012/11/21 20:48:38
Why? It was %d on purpose.
| |
90 if messages: | 90 if messages: |
91 url += '?messages=true' | 91 url += '?messages=true' |
92 return json.loads(self.get(url)) | 92 return json.loads(self.get(url)) |
93 | 93 |
94 def get_patchset_properties(self, issue, patchset): | 94 def get_patchset_properties(self, issue, patchset): |
95 """Returns the patchset properties.""" | 95 """Returns the patchset properties.""" |
96 url = '/api/%d/%d' % (issue, patchset) | 96 url = '/api/%d/%d' % (issue, patchset) |
97 return json.loads(self.get(url)) | 97 return json.loads(self.get(url)) |
98 | 98 |
99 def get_file_content(self, issue, patchset, item): | 99 def get_file_content(self, issue, patchset, item): |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 if not 'Name or service not known' in e.reason: | 388 if not 'Name or service not known' in e.reason: |
389 # Usually internal GAE flakiness. | 389 # Usually internal GAE flakiness. |
390 raise | 390 raise |
391 # If reaching this line, loop again. Uses a small backoff. | 391 # If reaching this line, loop again. Uses a small backoff. |
392 time.sleep(1+maxtries*2) | 392 time.sleep(1+maxtries*2) |
393 finally: | 393 finally: |
394 upload.ErrorExit = old_error_exit | 394 upload.ErrorExit = old_error_exit |
395 | 395 |
396 # DEPRECATED. | 396 # DEPRECATED. |
397 Send = get | 397 Send = get |
OLD | NEW |