~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/doc/malone-xmlrpc.txt

  • Committer: Curtis Hovey
  • Date: 2011-12-18 15:13:07 UTC
  • mto: This revision was merged to the branch mainline in revision 14547.
  • Revision ID: curtis.hovey@canonical.com-20111218151307-sdm2gzobt5tplbe0
Moved badges to lp.app.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
XML-RPC Integration with Malone
2
 
===============================
 
1
= XML-RPC Integration with Malone =
3
2
 
4
3
Malone provides an XML-RPC interface for filing bugs.
5
4
 
10
9
    ...     transport=XMLRPCTestTransport())
11
10
 
12
11
 
13
 
The filebug API
14
 
---------------
 
12
== The filebug API ==
15
13
 
16
14
The filebug API is:
17
15
 
42
40
Support for attachments will be added in the near future.
43
41
 
44
42
 
45
 
Examples
46
 
--------
 
43
== Examples ==
47
44
 
48
45
First, let's define a simple event listener to show that the
49
46
IObjectCreatedEvent is being published when a bug is reported through
50
47
the XML-RPC interface.
51
48
 
52
 
    >>> from lp.testing.event import TestEventListener
 
49
    >>> from canonical.launchpad.ftests.event import TestEventListener
53
50
    >>> from lazr.lifecycle.interfaces import IObjectCreatedEvent
54
51
    >>> from lp.bugs.interfaces.bug import IBug
55
52
 
152
149
    evolution
153
150
 
154
151
 
155
 
Error Handling
156
 
--------------
 
152
== Error Handling ==
157
153
 
158
154
Malone's xmlrpc interface provides extensive error handling. The various
159
155
error conditions it recognizes are:
175
171
    Traceback (most recent call last):
176
172
    ...
177
173
    Fault: <Fault 70: 'Too many arguments.
178
 
        You may specify either a product or a distribution, but not both.'>
 
174
            You may specify either a product or a distribution, but not both.'>
179
175
 
180
176
Specifying a non-existent product.
181
177
 
231
227
    >>> on_created_listener.unregister()
232
228
 
233
229
 
234
 
Generating bugtracker authentication tokens
235
 
-------------------------------------------
 
230
== Generating bugtracker authentication tokens ==
236
231
 
237
232
Launchpad Bugs also provides an XML-RPC API for generating login tokens
238
233
for authentication with external bug trackers.
239
234
 
240
235
    >>> from zope.component import getUtility
241
 
    >>> from lp.xmlrpc.interfaces import IPrivateApplication
242
 
    >>> from lp.bugs.interfaces.malone import IPrivateMaloneApplication
243
 
    >>> from lp.services.webapp.testing import verifyObject
 
236
    >>> from canonical.launchpad.interfaces.launchpad import (
 
237
    ...     IPrivateApplication,
 
238
    ...     IPrivateMaloneApplication,
 
239
    ...     )
 
240
    >>> from canonical.launchpad.webapp.testing import verifyObject
244
241
 
245
242
    >>> private_root = getUtility(IPrivateApplication)
246
243
    >>> verifyObject(IPrivateMaloneApplication,
250
247
The API provides a single method, newBugTrackerToken(), which returns
251
248
the ID of the new LoginToken.
252
249
 
253
 
    >>> from lp.services.verification.interfaces.logintoken import (
254
 
    ...     ILoginTokenSet)
255
 
    >>> from lp.services.webapp.servers import LaunchpadTestRequest
256
 
    >>> from lp.bugs.interfaces.externalbugtracker import (
257
 
    ...     IExternalBugTrackerTokenAPI)
 
250
    >>> from canonical.launchpad.interfaces.logintoken import ILoginTokenSet
 
251
    >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
 
252
    >>> from lp.bugs.interfaces.externalbugtracker import IExternalBugTrackerTokenAPI
258
253
    >>> from lp.bugs.xmlrpc.bug import (
259
254
    ...     ExternalBugTrackerTokenAPI)
260
255