Project

Profile

Help

Issue #3705

closed

Asynchronous updates to list objects does not work

Added by bizhang over 6 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 37
Quarter:

Description

When I try to update a python project: `http PATCH $REMOTE_HREF name='foo' projects:='[{"name":"pip-tools", "version_specifier":">=1.12,<=2.0"}]'`

`projects` always gets passed into `PythonRemoteSerializer.update()` as `[]`

Tracing through the code shows that we take the data and pass it to a QueryDict before passing it to a serializer: https://github.com/pulp/pulp/blob/3.0-dev/pulpcore/pulpcore/app/tasks/base.py#L32

Talking with @dkliban, this is done because there is some code that checks if it was a form submission from the browsable API or if it came from the rest API directly and not having the querydict there was causing it to think it was a form submission. A regular dictionary was making it always think it was a form submission.

But with this QueryDict, drf thinks list data is an HTML Input [https://github.com/encode/django-rest-framework/blob/master/rest_framework/serializers.py#L603\]
because the QueryDict has a getlist attribute on it [https://github.com/encode/django-rest-framework/blob/master/rest_framework/utils/html.py#L9\]

And parse_html_list returns a empty list on this data.

Also available in: Atom PDF