Project

Profile

Help

Refactor #1555

closed

ModelSerializer translate functions should be public

Added by semyers almost 9 years ago. Updated over 5 years 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

Actions
Actions #1

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.

Actions #2

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.

Actions #3

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.

Actions #4

Updated by semyers almost 9 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to semyers
Actions #5

Updated by amacdona@redhat.com almost 9 years ago

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

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

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.

fixes #1555 https://pulp.plan.io/issues/1555

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.

fixes #1555 https://pulp.plan.io/issues/1555

Actions #7

Updated by semyers almost 9 years ago

  • Status changed from ASSIGNED to POST
Actions #8

Updated by semyers almost 9 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #9

Updated by dkliban@redhat.com over 8 years ago

  • Platform Release set to 2.8.0
Actions #10

Updated by dkliban@redhat.com over 8 years ago

  • Status changed from MODIFIED to 5
Actions #11

Updated by dkliban@redhat.com over 8 years ago

  • Status changed from 5 to CLOSED - CURRENTRELEASE
Actions #12

Updated by bmbouter over 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF