Skip to content

Commit

Permalink
Provide example of method, close Fantomas42#6
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantomas42 committed Mar 23, 2017
1 parent 23689e2 commit f89c2d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ In a file called ``xmlrpc.py`` in your application directory. ::
XMLRPC_METHODS = (('path.to.your.method', 'Method name'),
('path.to.your.othermethod', 'Other Method name'),)

A registered method should look like this: ::

from django_xmlrpc.decorators import xmlrpc_func

@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
"""Simply returns the args passed to it as a string"""
return "Here's a response! %s" % str(text)

Finally we need to register the url of the XML-RPC server. Insert something
like this in your project's urls.py: ::

Expand Down
7 changes: 0 additions & 7 deletions django_xmlrpc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,12 @@
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt

from django_xmlrpc.decorators import xmlrpc_func
from django_xmlrpc.dispatcher import xmlrpc_dispatcher


logger = getLogger('xmlrpc.views')


@xmlrpc_func(returns='string', args=['string'])
def test_xmlrpc(text):
"""Simply returns the args passed to it as a string"""
return "Here's a response! %s" % str(text)


@csrf_exempt
def handle_xmlrpc(request):
"""Handles XML-RPC requests. All XML-RPC calls should be forwarded here
Expand Down

0 comments on commit f89c2d0

Please sign in to comment.