Comment 1 for bug 512828

Revision history for this message
Leonard Richardson (leonardr) wrote :

When the WADL is generated we go through all the interfaces that have @export_as_webservice_entry, and create a resource_type stanza for each one. You have two such interfaces, ISourcePackagePublishingHistory and IPublishingEdit, so your WADL contains two resource types: source_package_publishing_history and publishing_edit. publishing_edit is the one that defines requestDeletion, and in the WADL it serves no purpose but to confuse people. The requestDeletion operation is not present in source_package_publishing_history, which is the resource_type of any SourcePackagePublishingHistory you receive from the server, so it's not accessible from launchpadlib.

But, if a request does come in to invoke requestDeletion on an ISourcePackagePublishingHistory, lazr.restful does a multi-adapter lookup on the ISourcePackagePublishingHistory object, which also happens to implement IPublishingEdit. The lookup succeeds and the operation is invoked.

To get this to work as is, we would have to change from iterating over the @export_as_webservice_entry interfaces to iterating over every class that implements one or more @export_as_webservice_entry interfaces. I'm not sure how to do this but it doesn't sound like a bad idea--it would remove has_bugs and has_milestones from Launchpad's WADL, more resource types that only serve to confuse people. But it's a pretty major project that I don't want to undertake now, especially since you can fix this problem by making ISourcePackagePublishingHistory subclass IPublishingEdit and removing @export_as_webservice_entry from IPublishingEdit.

Incidentally, according to our web service publishing standards the name of the named operation should be request_deletion. Use a @export_as() call to give it the right name.