OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 # TODO: In the new layout, this should move to the ./services or |
| 6 # ./services/waterfall_app directories, since it is only used by Waterfall. |
| 7 |
| 8 # TODO: we ought to abstract over the HTTP_CLIENT member (which is only |
| 9 # used by the Post method) by passing it to the constructor. That way |
| 10 # things are more losely coupled, improving modularity and reducing |
| 11 # fragility. In addition, for easier mocking, we may want to just have |
| 12 # the thing passed for HTTP_CLIENT to be ``callable``, rather than giving |
| 13 # a name to the method we use on that object. |
| 14 |
5 import logging | 15 import logging |
6 import re | 16 import re |
7 import urlparse | 17 import urlparse |
8 | 18 |
9 from common.codereview import CodeReview | 19 from common.codereview import CodeReview |
10 from common.http_client_appengine import HttpClientAppengine | 20 from common.http_client_appengine import HttpClientAppengine |
11 | 21 |
12 | 22 |
13 _RIETVELD_ISSUE_NUMBER_RE = re.compile('^/(\d+)/?.*') | 23 _RIETVELD_ISSUE_NUMBER_RE = re.compile('^/(\d+)/?.*') |
14 | 24 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 'no_redirect': 'True', | 87 'no_redirect': 'True', |
78 } | 88 } |
79 content_type, body = self._EncodeMultipartFormData(form_fields) | 89 content_type, body = self._EncodeMultipartFormData(form_fields) |
80 headers = { | 90 headers = { |
81 'Content-Type': content_type, | 91 'Content-Type': content_type, |
82 'Accept': 'text/plain', | 92 'Accept': 'text/plain', |
83 } | 93 } |
84 status_code, content = self.HTTP_CLIENT.Post( | 94 status_code, content = self.HTTP_CLIENT.Post( |
85 url, data=body, headers=headers) | 95 url, data=body, headers=headers) |
86 return status_code == 200 and content == 'OK' | 96 return status_code == 200 and content == 'OK' |
OLD | NEW |