| 1 | = Trac XML-RPC Plugin = |
| 2 | |
| 3 | == Description == |
| 4 | |
| 5 | This plugin allows Trac to export select parts of its interface via XML-RPC. |
| 6 | |
| 7 | It also includes some exported functions for manipulating tickets, with plans to include functions for other parts of Tracs API. |
| 8 | |
| 9 | '' '''Note:''' Unfortunately, due to some issues with mod_pythons !FieldStorage emultation layer, this plugin requires the patch in [trac-ticket:2509 #T2509] to be applied to your Trac installation.'''' |
| 10 | |
| 11 | == Bugs/Feature Requests == |
| 12 | |
| 13 | Existing bugs and feature requests for XmlRpcPlugin are |
| 14 | [report:9?COMPONENT=XmlRpcPlugin here]. |
| 15 | |
| 16 | If you have any issues, create a |
| 17 | [http://trac-hacks.swapoff.org/newticket?component=XmlRpcPlugin&owner=athomas new ticket]. |
| 18 | |
| 19 | == Download == |
| 20 | |
| 21 | Download the zipped source from [download:xmlrpcplugin here]. |
| 22 | |
| 23 | == Source == |
| 24 | |
| 25 | You can check out the source for XmlRpcPlugin from Subversion at http://trac-hacks.swapoff.org/svn/xmlrpcplugin. |
| 26 | |
| 27 | == Example == |
| 28 | |
| 29 | === End-User Usage === |
| 30 | Obtain a list of XML-RPC exported functions available to my user: |
| 31 | |
| 32 | {{{ |
| 33 | #!python |
| 34 | import xmlrpclib |
| 35 | |
| 36 | server = xmlrpclib.ServerProxy("http://athomas:password@localhost/trac-dev/RPC2") |
| 37 | |
| 38 | print server.tracrpc.api.list_xmlrpc_functions() |
| 39 | }}} |
| 40 | |
| 41 | List all tickets that are owned by athomas: |
| 42 | |
| 43 | {{{ |
| 44 | #!python |
| 45 | import xmlrpclib |
| 46 | |
| 47 | server = xmlrpclib.ServerProxy("http://athomas:password@localhost/trac-dev/RPC2") |
| 48 | print server.tracrpc.ticket.query_tickets("owner=athomas") |
| 49 | }}} |
| 50 | |
| 51 | === API Usage === |
| 52 | Export a "hello world' function: |
| 53 | |
| 54 | {{{ |
| 55 | #!python |
| 56 | from tracrpc.api import IXMLRPCProvider |
| 57 | from trac.core import Component, implements |
| 58 | |
| 59 | class HelloWorld(Component): |
| 60 | implements(IXMLRPCProvider) |
| 61 | |
| 62 | def hello_world(self): |
| 63 | return "Hello world" |
| 64 | |
| 65 | def get_xmlrpc_functions(self): |
| 66 | yield ('WIKI_VIEW', self.hello_world) |
| 67 | }}} |
| 68 | |
| 69 | |
| 70 | == Author/Contributors == |
| 71 | |
| 72 | '''Author:''' [wiki:athomas] [[BR]] |
| 73 | '''Contributors:''' |
| 74 | |
| 75 | [[TagIt(plugin,athomas,alpha,0.9)]] |