Merge lp://staging/~cjwatson/lazr.restful/double-closing-brace into lp://staging/lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 221
Proposed branch: lp://staging/~cjwatson/lazr.restful/double-closing-brace
Merge into: lp://staging/lazr.restful
Diff against target: 58 lines (+14/-5)
3 files modified
src/lazr/restful/NEWS.txt (+6/-0)
src/lazr/restful/_resource.py (+2/-3)
src/lazr/restful/docs/webservice.txt (+6/-2)
To merge this branch: bzr merge lp://staging/~cjwatson/lazr.restful/double-closing-brace
Reviewer Review Type Date Requested Status
William Grant (community) code Approve
Review via email: mp+355847@code.staging.launchpad.net

Commit message

Fix double closing brace when encoding the result of a custom operation where the result has an adapter to ICollection.

Description of the change

Batch encoding is very weird; BatchingResourceMixin.batch intentionally omits the closing brace, and the caller is supposed to add it after possibly adding other parameters. This means that it's important for overridden implementations of the batch method in subclasses not to add the closing brace, as that violates the implied contract; only methods other than batch are allowed to add it. We were violating that rule in one code path, which resulted in a double closing brace.

This previously went unnoticed because of an overly-liberal doctest (which I had to fix anyway in order to cope with varying dict iteration order) and I think also because Launchpad tends to declare operations as having a return_type providing ICollectionField rather than directly returning something that can be adapted to ICollection.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches