| 2 | | |
| 3 | | This uses SimpleXMLRPCDispatcher which is part of the standard Python lib in 2.4 (And possibly earlier versions). |
| 4 | | |
| 5 | | |
| 6 | | In discussing ways of handling XML-RPC for Django, I realised I really needed a way to do it without patching Django's code. Crast in #django came up with a great solution, which I have modified and tweaked a bit. |
| 7 | | |
| 8 | | I've included it here. Feel free to fiddle with it and make it your own ... All this code is '''post-mr''' |
| 9 | | |
| 10 | | Any crappy & garbage code is completely mine; I'm still learning Python so bear with me. The hacks I added for self-documentation output are just that; any improvements to them would probably be a good thing. |
| 11 | | |
| 12 | | First, setup your urls.py to map an XML-RPC service: |
| 13 | | |
| 14 | | |
| 15 | | {{{ |
| 16 | | #!python |
| 17 | | urlpatterns = patterns('', |
| 18 | | # XML-RPC |
| 19 | | (r'^xml_rpc_srv/', 'yourproject.yourapp.xmlrpc.rpc_handler'), |
| 20 | | ) |
| 21 | | }}} |
| 22 | | |
| 23 | | |
| 24 | | Then, in the appropriate place, create a file called xmlrpc.py |
| | 2 | hjtgjfhgjgjf |
| | 3 | 'op['iop[iop |
| | 4 | ijkuiouioiuouio |
| | 5 | []p[o]p[]p[]pjyguigfyi |