This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
bugtracker [2008/07/03 10:17] klette added some more on trac |
bugtracker [2008/07/03 10:37] klette fixed trac rpc stuff. Changed a lot in newer versions |
||
---|---|---|---|
Line 106: | Line 106: | ||
=== RPC interface === | === RPC interface === | ||
- | Trac does not have an rpc interface per default, but there is a plugin available that exposes the python api. | + | Trac does not have an rpc interface per default, but there is a plugin available that exposes some of the python api. |
- | It works by sending a list of functions and their parameters to the rpc. | + | |
- | ie | + | |
<code python> | <code python> | ||
- | send(( | + | import xmlrpclib |
- | (add-bug, (param1, param2, param3)), | + | # Connect |
- | (close-bug, (param1, param2, param3)), | + | server = xmlrpclib.ServerProxy("https://kristian.klette@uninett.no:notmyrealpassword@localhost/trac-dev/login/xmlrpc") |
- | )) | + | |
+ | # Report a bug | ||
+ | ticketid = server.ticket.create("My summary", "A description of the problem") | ||
+ | |||
+ | # base64 encode traceback | ||
+ | import base64 | ||
+ | trackeback = base64.b64encode(get_traceback()) | ||
+ | |||
+ | # Add traceback to ticket | ||
+ | server.ticket.putAttachment(ticketid, "traceback.log", "Traceback of the error", traceback) | ||
+ | |||
+ | print "Created ticket", ticketid | ||
</code> | </code> | ||
- | (not a real api calls) | ||
- | This is very flexible and allows us to do lots a crazy stuff, but it opens a security issue, and is hard to | + | The api it self is quite nice actually, though poorly documented. A rough api-coverage is given at www.track-hacks.org, but only to authenticated users. |
- | use for anything other than internal use. | + | |
=== Code hosting/integration === | === Code hosting/integration === |