Skip to content

Commit

Permalink
Add detail Remote 'policy' redefinition docs
Browse files Browse the repository at this point in the history
To use on-demand content with more 'policy' values the Remote Serializer
needs to redefine the 'policy' attribute. This is now included in the
docstring so plugin writers can decide.

https://pulp.plan.io/issues/4990
closes #4990
  • Loading branch information
Brian Bouterse committed Jun 27, 2019
1 parent f35dd58 commit b9ffe95
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bootstrap_templates/app/serializers.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ class {{ plugin_camel_short }}RemoteSerializer(platform.RemoteSerializer):

class Meta:
validators = platform.RemoteSerializer.Meta.validators + [myValidator1, myValidator2]

By default the 'policy' field in platform.RemoteSerializer only validates the choice
'immediate'. To add on-demand support for more 'policy' options, e.g. 'streamed' or 'on_demand',
re-define the 'policy' option as follows::

policy = serializers.ChoiceField(
help_text="The policy to use when downloading content. The possible values include: "
"'immediate', 'on_demand', and 'streamed'. 'immediate' is the default.",
choices=models.Remote.POLICY_CHOICES,
default=models.Remote.IMMEDIATE
)
"""

class Meta:
Expand Down

0 comments on commit b9ffe95

Please sign in to comment.