Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: rietveld.py

Issue 11941019: Make logging a bit shorter on Rietveld().add_comment(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 logging.info('new description for issue %d' % issue) 239 logging.info('new description for issue %d' % issue)
240 self.post('/%d/description' % issue, [ 240 self.post('/%d/description' % issue, [
241 ('description', description), 241 ('description', description),
242 ('xsrf_token', self.xsrf_token())]) 242 ('xsrf_token', self.xsrf_token())])
243 243
244 def add_comment(self, issue, message, add_as_reviewer=False): 244 def add_comment(self, issue, message, add_as_reviewer=False):
245 max_message = 10000 245 max_message = 10000
246 tail = '…\n(message too large)' 246 tail = '…\n(message too large)'
247 if len(message) > max_message: 247 if len(message) > max_message:
248 message = message[:max_message-len(tail)] + tail 248 message = message[:max_message-len(tail)] + tail
249 logging.info('issue %d; comment: %s' % (issue, message)) 249 logging.info('issue %d; comment: %s' % (issue, message.strip()))
250 return self.post('/%d/publish' % issue, [ 250 return self.post('/%d/publish' % issue, [
251 ('xsrf_token', self.xsrf_token()), 251 ('xsrf_token', self.xsrf_token()),
252 ('message', message), 252 ('message', message),
253 ('message_only', 'True'), 253 ('message_only', 'True'),
254 ('add_as_reviewer', str(bool(add_as_reviewer))), 254 ('add_as_reviewer', str(bool(add_as_reviewer))),
255 ('send_mail', 'True'), 255 ('send_mail', 'True'),
256 ('no_redirect', 'True')]) 256 ('no_redirect', 'True')])
257 257
258 def set_flag(self, issue, patchset, flag, value): 258 def set_flag(self, issue, patchset, flag, value):
259 return self.post('/%d/edit_flags' % issue, [ 259 return self.post('/%d/edit_flags' % issue, [
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 if not messages: 440 if not messages:
441 # Assumes self._lookup uses deepcopy. 441 # Assumes self._lookup uses deepcopy.
442 del data['messages'] 442 del data['messages']
443 return data 443 return data
444 444
445 def get_patchset_properties(self, issue, patchset): 445 def get_patchset_properties(self, issue, patchset):
446 return self._lookup( 446 return self._lookup(
447 'get_patchset_properties', 447 'get_patchset_properties',
448 (issue, patchset), 448 (issue, patchset),
449 super(CachingRietveld, self).get_patchset_properties) 449 super(CachingRietveld, self).get_patchset_properties)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698