Can't promote a write operation to a mutator operation

Bug #720146 reported by Leonard Richardson
6
This bug affects 1 person
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 IOperationPromotedToMutator(Interface):
    ... export_as_webservice_entry()
    ...
    ... field = exported(TextLine(readonly=True))
    ...
    ... @mutator_for(field)
    ... @operation_for_version('3.0')
    ... @operation_parameters(text=TextLine())
    ... @export_write_operation()
    ... @operation_for_version('1.0')
    ... 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-declarations.txt so that version n+1 is a subclass of version n. This more closely reproduces the behavior of a real lazr.restful web service, and lets me do a more realistic test.

Related branches

Changed in lazr.restful:
status: New → Fix Released
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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