Named operations bypass any normalization done by fields

Bug #400477 reported by Curtis Hovey
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned
lazr.restful
Triaged
Low
Unassigned

Bug Description

When calling named operations on the web service, the IField API is only used to validate the parameter.

The IField.set() method is never called (because there is no real context to which to assign the value). When IField do normalization in the set() method, that normalization won't happen on named operation parameters.

The fix would be to create a "parameters context object" which is bound to the field and call set() to set the parameters value. And then retrieve the value to use for the underlying method calls from this parameter object.

Curtis Hovey (sinzui)
Changed in lazr.restful:
status: New → Triaged
importance: Undecided → High
Changed in launchpad-foundations:
status: New → Triaged
importance: Undecided → High
Changed in lazr.restful:
importance: High → Low
Revision history for this message
Curtis Hovey (sinzui) wrote :

The create milestone form used the NoneableTextWidget to prevent meaningless code names from being created, but the field marshaller does not honour the rules, see bug 400268.

summary: - FieldMarshallers do not honor a Field's set() rules
+ Named operations bypass any normalization done by fields
description: updated
tags: added: api
Revision history for this message
Francis J. Lacoste (flacoste) wrote :

It might be worthwhile to explicitely mark fields that do normalization.

Define a INormalizedField that only define a normalize(value) method. Instead of creating a fake context on which we can call the set() method to retrieve the normalized value, ResourceOperation could simply call normalize() on fields that support it, otherwise use the unmarshalled value directly.

Curtis Hovey (sinzui)
tags: added: tech-debt
Revision history for this message
Robert Collins (lifeless) wrote :

Setting the LP task to low - if / when a bug requires this in order to be fixed, it can escalate this bug, but until then we're not suffering AFAICT.

Changed in launchpad:
importance: High → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.