Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong href's in results from collection viewsets #254

Merged
merged 1 commit into from Jun 18, 2020

Conversation

alikins
Copy link
Contributor

@alikins alikins commented Jun 18, 2020

The pulp_ansible viewsets build hrefs by reverse() on the
pulp_ansible url name. But the galaxy_ng names are different
and include url namespaces ('galaxy:api:v3:collection' for ex).

Makes collection api endpoints serialize correctly, with the various
href's pointing to the right places. That includes:

  1. Not pointing to the pulp hrefs
  2. pointing to either the default-content endpoint or the per-repo
    endpoints

Update the collection url 'names' so that suffix matches the
upstream pulp names exactly (sanes url namespace)

Add custom collection Serializer's that uses view_namespace for url reverse.

Add a serializers.collections.HrefNamespaceMixin to use
with the galaxy_ng subclasses of collection related
pulp_ansible.app.galaxy Serializers.

Update the collection related viewsets to use the new
viewsets.

Add a ViewNamespaceSerializerContextMixin to mixin
with the collection viewset. This provides a
get_serializer_context that adds 'view_namespace'
and 'view_route' info to the context, so the various
href serializer methods will generate the correct urls.

Issue: #247

The pulp_ansible viewsets build hrefs by reverse() on the
pulp_ansible url name. But the galaxy_ng names are different
and include url namespaces ('galaxy:api:v3:collection' for ex).

Makes collection api endpoints serialize correctly, with the various
href's pointing to the right places. That includes:

  a) Not pointing to the pulp hrefs
  b) pointing to either the default-content endpoint or the per-repo
endpoints

Update the collection url 'names' so that suffix matches the
upstream pulp names exactly (sanes url namespace)

Add custom collection Serializer's that uses view_namespace for url reverse.

Add a serializers.collections.HrefNamespaceMixin to use
with the galaxy_ng subclasses of collection related
pulp_ansible.app.galaxy Serializers.

Update the collection related viewsets to use the new
viewsets.

Add a ViewNamespaceSerializerContextMixin to mixin
with the collection viewset. This provides a
get_serializer_context that adds 'view_namespace'
and 'view_route' info to the context, so the various
href serializer methods will generate the correct urls.

Issue: #247
@alikins alikins force-pushed the fix_href_pulp_viewsets_247 branch from ab56878 to 3c5cb8f Compare June 18, 2020 19:30
@chouseknecht
Copy link
Contributor

LGTM. I really want to get this fixed, so happy to see this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants