Project

Profile

Help

Issue #3276

CreatedResource can only serialize objects whose href is their pk

Added by amacdona@redhat.com about 2 years ago. Updated 3 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

The CreatedResource is serialized on a Task as the href to the resource.

Here is the offending line:
https://github.com/pulp/pulp/blob/2904dd1c6fa947244c0bb98ca5b84acba15f188e/pulpcore/pulpcore/app/serializers/task.py#L27

This works for Publications and any other resource whose href has pk as the only url parameter. It doesn't work for resources whose href has url parameters, like RepositoryVersion.

reverse for Publications uses only "pk"

http://pulp3.dev:8000/api/v3/publications/56a08642-a9d8-42bb-91dd-d1f5021124dd/

reverse for RepositoryVersion needs "repository_pk", "number"

http://pulp3.dev:8000/api/v3/repositories/026b1ce6-8959-43a7-ac63-54a809dea4b6/versions/6/

Associated revisions

Revision e894e19e View on GitHub
Added by amacdona@redhat.com about 2 years ago

Make CreatedResource serialize any resource

Using the model's serializer rather than reverse allows us to generate hrefs for objects that use any set of url parameters.

closes #3276 https://pulp.plan.io/issues/3276

Revision e894e19e View on GitHub
Added by amacdona@redhat.com about 2 years ago

Make CreatedResource serialize any resource

Using the model's serializer rather than reverse allows us to generate hrefs for objects that use any set of url parameters.

closes #3276 https://pulp.plan.io/issues/3276

History

#1 Updated by amacdona@redhat.com about 2 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to amacdona@redhat.com

#2 Updated by amacdona@redhat.com about 2 years ago

  • Status changed from ASSIGNED to POST

#3 Updated by amacdona@redhat.com about 2 years ago

  • Status changed from POST to MODIFIED

#4 Updated by dkliban@redhat.com about 2 years ago

  • Tags Pulp 3, Pulp 3 MVP added

#5 Updated by dkliban@redhat.com almost 2 years ago

  • Sprint/Milestone set to 3.0.0

#6 Updated by bmbouter 10 months ago

  • Tags deleted (Pulp 3, Pulp 3 MVP)

#7 Updated by bmbouter 3 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF