Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Move single-artifact related code into core #3476

Closed
wants to merge 1 commit into from
Closed

Move single-artifact related code into core #3476

wants to merge 1 commit into from

Conversation

daviddavis
Copy link
Contributor

daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Apr 26, 2018
daviddavis pushed a commit to daviddavis/pulp_ansible that referenced this pull request Apr 26, 2018
@@ -138,6 +138,27 @@ def natural_key(self):
return tuple(getattr(self, f) for f in self.natural_key_fields())


class SingleArtifactContent:
Copy link
Contributor

@jortel jortel Apr 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a mixin instead of a subclass of Content? Multiple inheritance (mixins) are generally considered to be bad practice.

Why not add these convenience properties to Content?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will make SingleArtifactContent a subclass 👍

The reason I didn't want to add these to Content is that I didn't want plugin writers to accidentally call them if they're dealing with Content that may have multiple artifacts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm cool with adding them to Content though and maybe being explicit in the docstring that they're not for use with Content that can have multiple artifacts?

Copy link
Contributor

@jortel jortel Apr 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, after looking at this harder .. Can you help me understand the value of this? Methods with 1 line of code raises a yellow flag. How is this better than the caller just doing the same line of code?

daviddavis pushed a commit to daviddavis/pulp_file that referenced this pull request Apr 26, 2018
daviddavis pushed a commit to daviddavis/pulp_ansible that referenced this pull request Apr 26, 2018
@dralley dralley added the 3.0 label Apr 26, 2018

headers = self.get_success_headers(serializer.data)
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
return super().create(request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be overridden at all if we're just calling super()?

@daviddavis
Copy link
Contributor Author

Abandoning this work. May create a serializer in the future to handle this.

@daviddavis daviddavis closed this Apr 27, 2018
dkliban pushed a commit to dkliban/pulp that referenced this pull request May 31, 2018
Looks like django requires certain features of hostnames like a "." so
using `get_host()` was not a good idea. Using a known valid hostname
instead.

fixes pulp#3476
https://pulp.plan.io/issues/3476
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants