Comment 1 for bug 389872

Revision history for this message
Jonathan Lange (jml) wrote :

This is a pretty straightforward bug to fix. There are two major components to it: setting up our GPG key objects to be exported via the API and then exporting the GPG key attributes that are on the Person object.

For the first one, you'll want to edit lp/registry/interfaces/gpg.py. In order to prepare the IGPGKey object for exporting, you'll need to tweak the interface a bit. I'd suggest looking at lp/registry/interfaces/sourcepackage.py for another example of this. The trick is to find the invocations of things that were imported from lazr.restful.

For the second one, look at lp/registry/interfaces/person.py. You'll see a bunch of attributes on the IPersonPublic interface that are wrapped in exported(). You'll want to do the same for gpgkeys, pendinggpgkeys and probably others.

You can run the tests for the Person webservice with the command './bin/test -1cvvt webservice/xx-person.txt'. You can find the tests in canonical/launchpad/pagetests/webservice/xx-person.txt. The tests really ought to live in lp/registry/stories/webservice/, but one thing at a time.

Running 'make build' and then 'make run' and browsing to https://launchpad.dev/+apidoc can be helpful for checking the API documentation, and for confirming that the attributes are, in fact, exposed.

Let me know if you have any questions.