Can't promote a write operation to a mutator operation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.restful |
Fix Released
|
High
|
Unassigned |
Bug Description
I'm just filing this bug for bookkeeping purposes. Here's a description from the merge proposal that fixed it:
Let me explain this in terms of the class I used to test it.
>>> class IOperationPromo
... export_
...
... field = exported(
...
... @mutator_for(field)
... @operation_
... @operation_
... @export_
... @operation_
... def set_value(text):
... pass
The example web service has four versions: beta, 1.0, 2.0, and 3.0. In 'beta', mutator methods were also published as named operations (just like in Launchpad 'beta'), but that behavior stopped in 1.0. Call 1.0 the 'cutoff version'.
The 'set_value' method is introduced in 1.0, and it's a normal write operation in 2.0, but in 3.0 it's promoted to a mutator method.
Here's the problem: this method was not available in 1.0 or 2.0. lazr.restful saw that set_value was defined as a mutator, and added a mask registration to stop it from showing up as of the 'cutoff version', 1.0. This would have been the correct behavior if set_value was defined as a mutator *before* the cutoff version, but actually it was defined as a mutator *after* the cutoff version.
lazr.restful was masking the write operation registration in the cutoff version if the method was defined as a mutator in *any* version. This branch changes it so that the operation is only masked in the cutoff version if it was defined as a mutator *before* the cutoff version. If a method is promoted to a mutator after the cutoff version, a lookup for that method will fail starting in the promotion version.
This branch also changes the versioned request marker interfaces in webservice-
Related branches
- Данило Шеган (community): Approve
-
Diff: 231 lines (+102/-25)4 files modifiedsrc/lazr/restful/NEWS.txt (+11/-5)
src/lazr/restful/docs/webservice-declarations.txt (+65/-5)
src/lazr/restful/metazcml.py (+25/-14)
src/lazr/restful/version.txt (+1/-1)
Changed in lazr.restful: | |
status: | New → Fix Released |
importance: | Undecided → High |