OLD | NEW |
---|---|
1 # coding: utf-8 | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 4 # found in the LICENSE file. |
4 """Defines class Rietveld to easily access a rietveld instance. | 5 """Defines class Rietveld to easily access a rietveld instance. |
5 | 6 |
6 Security implications: | 7 Security implications: |
7 | 8 |
8 The following hypothesis are made: | 9 The following hypothesis are made: |
9 - Rietveld enforces: | 10 - Rietveld enforces: |
10 - Nobody else than issue owner can upload a patch set | 11 - Nobody else than issue owner can upload a patch set |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 return svn_props | 211 return svn_props |
211 | 212 |
212 def update_description(self, issue, description): | 213 def update_description(self, issue, description): |
213 """Sets the description for an issue on Rietveld.""" | 214 """Sets the description for an issue on Rietveld.""" |
214 logging.info('new description for issue %s' % issue) | 215 logging.info('new description for issue %s' % issue) |
215 self.post('/%s/description' % issue, [ | 216 self.post('/%s/description' % issue, [ |
216 ('description', description), | 217 ('description', description), |
217 ('xsrf_token', self.xsrf_token())]) | 218 ('xsrf_token', self.xsrf_token())]) |
218 | 219 |
219 def add_comment(self, issue, message): | 220 def add_comment(self, issue, message): |
221 max_message = 10000 | |
222 tail = '…\n(message too large)' | |
223 if len(message) > max_message: | |
224 message = message[:max_message-len(tail)] + tail | |
Peter Mayo (wrong one)
2012/05/04 03:05:36
Thanks for catching the "max_message - "
Why doesn
| |
220 logging.info('issue %s; comment: %s' % (issue, message)) | 225 logging.info('issue %s; comment: %s' % (issue, message)) |
221 return self.post('/%s/publish' % issue, [ | 226 return self.post('/%s/publish' % issue, [ |
222 ('xsrf_token', self.xsrf_token()), | 227 ('xsrf_token', self.xsrf_token()), |
223 ('message', message), | 228 ('message', message), |
224 ('message_only', 'True'), | 229 ('message_only', 'True'), |
225 ('send_mail', 'True'), | 230 ('send_mail', 'True'), |
226 ('no_redirect', 'True')]) | 231 ('no_redirect', 'True')]) |
227 | 232 |
228 def set_flag(self, issue, patchset, flag, value): | 233 def set_flag(self, issue, patchset, flag, value): |
229 return self.post('/%s/edit_flags' % issue, [ | 234 return self.post('/%s/edit_flags' % issue, [ |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 if not 'Name or service not known' in e.reason: | 336 if not 'Name or service not known' in e.reason: |
332 # Usually internal GAE flakiness. | 337 # Usually internal GAE flakiness. |
333 raise | 338 raise |
334 # If reaching this line, loop again. Uses a small backoff. | 339 # If reaching this line, loop again. Uses a small backoff. |
335 time.sleep(1+maxtries*2) | 340 time.sleep(1+maxtries*2) |
336 finally: | 341 finally: |
337 upload.ErrorExit = old_error_exit | 342 upload.ErrorExit = old_error_exit |
338 | 343 |
339 # DEPRECATED. | 344 # DEPRECATED. |
340 Send = get | 345 Send = get |
OLD | NEW |