Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 | 4 |
| 5 from oauth2client.client import SignedJwtAssertionCredentials | 5 from oauth2client.client import SignedJwtAssertionCredentials |
| 6 import httplib2 | 6 import httplib2 |
| 7 import model.app_config | 7 import model.app_config |
| 8 import urllib | 8 import urllib |
| 9 import util | 9 import util |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 def post_data(self, req, payload=None): | 59 def post_data(self, req, payload=None): |
| 60 actual_payload = dict(payload or {}) | 60 actual_payload = dict(payload or {}) |
| 61 actual_payload['xsrf_token'] = self.xsrf_token | 61 actual_payload['xsrf_token'] = self.xsrf_token |
| 62 | 62 |
| 63 return self.make_request(req, method='POST', | 63 return self.make_request(req, method='POST', |
| 64 body=urllib.urlencode(actual_payload)) | 64 body=urllib.urlencode(actual_payload)) |
| 65 | 65 |
| 66 def post_issue_data(self, issue, req, payload): | 66 def post_issue_data(self, issue, req, payload): |
| 67 return self.post_data('%s/%s' % (issue, req), payload) | 67 return self.post_data('%s/%s' % (issue, req), payload) |
| 68 | 68 |
| 69 def post_comment(self, issue, comment, submit_inline_comments=False): | 69 def post_message(self, issue, comment, subject=None, send_mail=False): |
|
agable
2013/08/27 14:49:19
This method isn't called anywhere? Was publish_inl
Mattias Nissler (ping if slow)
2013/08/27 15:08:41
There are no unit tests, I just wanted to keep the
| |
| 70 publish_payload = { | 70 publish_payload = { |
| 71 'message_only': 0 if submit_inline_comments else 1, | |
| 72 'send_mail': 1, | |
| 73 'add_as_reviewer': 0, | |
|
agable
2013/08/27 14:49:19
Does add_as_reviewer default to 0?
Mattias Nissler (ping if slow)
2013/08/27 15:08:41
It's no longer supported by rietveld.
| |
| 74 'message': comment, | 71 'message': comment, |
| 72 'message_only': 1, | |
| 75 'no_redirect': 1, | 73 'no_redirect': 1, |
| 74 'send_mail': 1 if send_mail else 0, | |
| 76 } | 75 } |
| 76 if subject is not None: | |
| 77 publish_payload['subject'] = subject | |
| 78 self.post_issue_data(issue, 'publish', publish_payload) | |
| 79 | |
| 80 def publish_inline_comments(self, issue, comment, reviewers, cc, | |
| 81 subject=None, send_mail=False): | |
| 82 publish_payload = { | |
| 83 'cc': cc, | |
| 84 'message': comment, | |
| 85 'message_only': 0, | |
| 86 'no_redirect': 1, | |
| 87 'reviewers': reviewers, | |
| 88 'send_mail': 1 if send_mail else 0, | |
| 89 } | |
| 90 if subject is not None: | |
| 91 publish_payload['subject'] = subject | |
| 77 self.post_issue_data(issue, 'publish', publish_payload) | 92 self.post_issue_data(issue, 'publish', publish_payload) |
| 78 | 93 |
| 79 def add_inline_comment(self, issue_id, patchset_id, patch_id, line, a_or_b, | 94 def add_inline_comment(self, issue_id, patchset_id, patch_id, line, a_or_b, |
| 80 comment): | 95 comment): |
| 81 comment_payload = { | 96 comment_payload = { |
| 82 'snapshot': 'old' if a_or_b is 'a' else 'new', | 97 'snapshot': 'old' if a_or_b is 'a' else 'new', |
| 83 'lineno': line, | 98 'lineno': line, |
| 84 'side': a_or_b, | 99 'side': a_or_b, |
| 85 'issue': issue_id, | 100 'issue': issue_id, |
| 86 'patchset': patchset_id, | 101 'patchset': patchset_id, |
| 87 'patch': patch_id, | 102 'patch': patch_id, |
| 88 'text': comment, | 103 'text': comment, |
| 89 } | 104 } |
| 90 self.post_data('inline_draft', comment_payload) | 105 self.post_data('inline_draft', comment_payload) |
| OLD | NEW |