Refactor #1555
closedModelSerializer translate functions should be public
100%
Description
ModelSerializer knows how to translate model fields when crafting responses, and also how to translate fields when parsing incoming requests. Unfortunately, it currently only exposes the latter behavior via its "translate_criteria" method. The "_translate" and "_translate_filters" methods are generally useful, and should be made public.
Related issues
Updated by bmbouter almost 9 years ago
Note, it's not exclusively ID fields. We also had to change from to errata_from since 'from' is a reserved Python keyword. Because of that I suggest ID_FIELD.
Also note, there are at least two places where inbound data is also supposed to be transformed. See issue #1433 which described de-duplicating them and also links to the code which does the inbound translation.
Updated by semyers almost 9 years ago
Austin and I spoke about this, and I've also been dealing with the serializers a little more in-depth today, so I'll either reword this to match my updated thinking, or close it as a nonissue.
Updated by semyers almost 9 years ago
- Subject changed from Models with remapped id fields should know what field stores the ID to ModelSerializer translate functions should be public
- Description updated (diff)
This issue has been updated to reflect a more reasonable/less drastic first step in dealing with the issues raised in the original description.
Updated by semyers almost 9 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to semyers
Updated by amacdona@redhat.com almost 9 years ago
- Related to Task #1578: Incoming searches should be translated by the model added
Updated by semyers almost 9 years ago
I did a quick'n'dirty version of this in a recent commit[0] by publicizing the generally-useful private functions, so the work for this refactor consists mainly of fixing BaseSerializer and its subclasses to use the public method names and remove the private method names.
Added by semyers almost 9 years ago
Added by semyers almost 9 years ago
Revision 9ea304bd | View on GitHub
publicize useful serializer methods
As mentioned in the referenced issue, these serializer methods are generally useful and have been exposed as "public" in a previous commit. This makes that change formal by updating serializer internal references and tests to use the public methods.
Updated by semyers almost 9 years ago
- Status changed from ASSIGNED to POST
Updated by semyers almost 9 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|9ea304bd027f39280ebcda47e1e45d0b693f583a.
Updated by dkliban@redhat.com over 8 years ago
- Status changed from MODIFIED to 5
Updated by dkliban@redhat.com over 8 years ago
- Status changed from 5 to CLOSED - CURRENTRELEASE
publicize useful serializer methods
As mentioned in the referenced issue, these serializer methods are generally useful and have been exposed as "public" in a previous commit. This makes that change formal by updating serializer internal references and tests to use the public methods.
fixes #1555 https://pulp.plan.io/issues/1555