|
16 | 16 | from docker.errors import NotFound as DockerNotFoundError
|
17 | 17 | from requests.exceptions import ConnectionError
|
18 | 18 | from requests.exceptions import ReadTimeout
|
19 |
| -from requests_toolbelt.multipart.encoder import MultipartEncoder |
20 | 19 |
|
21 | 20 | from readthedocs.builds.models import BuildCommandResultMixin
|
22 | 21 | from readthedocs.core.utils import slugify
|
23 |
| -from readthedocs.projects.models import Feature |
24 | 22 |
|
25 | 23 | from .constants import DOCKER_HOSTNAME_MAX_LEN
|
26 | 24 | from .constants import DOCKER_IMAGE
|
@@ -270,35 +268,12 @@ def save(self, api_client):
|
270 | 268 |
|
271 | 269 | # If the command has an id, it means it has been saved before,
|
272 | 270 | # so we update it instead of creating a new one.
|
273 |
| - if self.build_env.project.has_feature(Feature.API_LARGE_DATA): |
274 |
| - # Don't use slumber directly here. Slumber tries to enforce a string, |
275 |
| - # which will break our multipart encoding here. |
276 |
| - encoder = MultipartEncoder({key: str(value) for key, value in data.items()}) |
277 |
| - if self.id: |
278 |
| - resource = api_client.command(self.id).patch |
279 |
| - resp = resource._store["session"].patch( |
280 |
| - resource._store["url"], |
281 |
| - data=encoder, |
282 |
| - headers={ |
283 |
| - "Content-Type": encoder.content_type, |
284 |
| - }, |
285 |
| - ) |
286 |
| - else: |
287 |
| - resource = api_client.command.post |
288 |
| - resp = resource._store["session"].post( |
289 |
| - resource._store["base_url"], |
290 |
| - data=encoder, |
291 |
| - headers={ |
292 |
| - "Content-Type": encoder.content_type, |
293 |
| - }, |
294 |
| - ) |
295 |
| - log.debug("Response via multipart form.", response=resp) |
| 271 | + if self.id: |
| 272 | + resp = api_client.command(self.id).patch(data) |
296 | 273 | else:
|
297 |
| - if self.id: |
298 |
| - resp = api_client.command(self.id).patch(data) |
299 |
| - else: |
300 |
| - resp = api_client.command.post(data) |
301 |
| - log.debug("Response via JSON encoded data.", response=resp) |
| 274 | + resp = api_client.command.post(data) |
| 275 | + |
| 276 | + log.debug("Response via JSON encoded data.", response=resp) |
302 | 277 |
|
303 | 278 | self.id = resp.get("id")
|
304 | 279 |
|
|
0 commit comments