Hi Muhammad,
On 08/17/2011 08:18 PM, Muhammad Choudry wrote: > I've > found that JSON-RPC is a good way to go for this, as there is > typically built in support for this in javascript in addition to the > numerous additional benefits. > > I've seen several ways to do this: > 1) Create a unique URI for each function that you would like to > access: > https://code.djangoproject.com/wiki/JSONRPCServerMiddleware > 2) Create one point of access, and pass the method name in the JSON > package. In this particular example an SMD is automatically > generated. > https://code.djangoproject.com/wiki/Jsonrpc > > The issue with (1) is that if there are many functions to be accessed, > then there will be many URI's that will be used. This does not seem > like an elegant solution. The issue with (2) is that I need to > compare functions against a list of all functions. Again this is not > an elegant solution either. > > Is there no way that we can take the advantages of (1) and (2) to > create an interface such that: > - Only one URI is used as a point of access > - Functions are called directly (without having to be compared > against a list of functions) > > ? > Did you look at rpc4django. The way it works roughly: - you add rpc4django to the installed apps - in urls.py you create one uri for the rpc calls - you simply decorate all functions, that should be available via RPC. By default the function will be available as xmlrpc and jsonrpc function. For more details: http://packages.python.org/rpc4django/setup.html -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.