Project

Profile

Help

Refactor #1555

ModelSerializer translate functions should be public

Added by semyers over 4 years ago. Updated over 1 year ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
2.8.0
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

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

Related to Pulp - Task #1578: Incoming searches should be translated by the modelCLOSED - WONTFIX

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 9ea304bd View on GitHub
Added by semyers over 4 years ago

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

Revision 9ea304bd View on GitHub
Added by semyers over 4 years ago

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

History

#1 Updated by bmbouter over 4 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.

#2 Updated by semyers over 4 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.

#3 Updated by semyers over 4 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.

#4 Updated by semyers over 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to semyers

#5 Updated by amacdona@redhat.com over 4 years ago

  • Related to Task #1578: Incoming searches should be translated by the model added

#6 Updated by semyers over 4 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.

#7 Updated by semyers over 4 years ago

  • Status changed from ASSIGNED to POST

#8 Updated by semyers over 4 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#9 Updated by dkliban@redhat.com over 4 years ago

  • Platform Release set to 2.8.0

#10 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from MODIFIED to 5

#11 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE

#12 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF