Package expedient :: Package common :: Package rpc4django :: Module views
[hide private]
[frames] | no frames]

Module views

source code


Views

This module contains the method serve_rpc_request which is intended to
be called from the urls.py module of a 
`django <http://www.djangoproject.com/>`_ project.

It should be called like this from urls.py:

    rpc_url(r'^RPC2$', name="my_url_name"),

Classes [hide private]
  NonExistingDispatcher
Raised when the dispatcher for a particular name is not found.
Functions [hide private]
 
get_dispatcher(path, url_name) source code
 
_check_request_permission(request, request_format='xml', url_name='root')
Checks whether this user has permission to perform the specified action This method does not check method call validity.
source code
 
_is_xmlrpc_request(request)
Determines whether this request should be served by XMLRPC or JSONRPC
source code
 
serve_rpc_request(*args, **kwargs)
This method handles rpc calls based on the content type of the request
source code
 
_register_rpcmethods(apps, restrict_introspection=False, dispatchers=_register_rpcmethods(APPS, RESTRICT_INTROSPECTION))
Scans the installed apps for methods with the rpcmethod decorator Adds these methods to the list of methods callable via RPC
source code
Variables [hide private]
  LOG_REQUESTS_RESPONSES = True
  RESTRICT_INTROSPECTION = False
  RESTRICT_JSON = False
  RESTRICT_XML = False
  RESTRICT_METHOD_SUMMARY = False
  RESTRICT_RPCTEST = False
  HTTP_ACCESS_CREDENTIALS = False
  HTTP_ACCESS_ALLOW_ORIGIN = ''
  APPS = ['expedient.clearinghouse.firstapp', 'django.contrib.au...
  logger = logging.getLogger("rpc4django.views")
  dispatchers = _register_rpcmethods(APPS, RESTRICT_INTROSPECTION)
  __package__ = 'expedient.common.rpc4django'
Function Details [hide private]

_check_request_permission(request, request_format='xml', url_name='root')

source code 

Checks whether this user has permission to perform the specified action
This method does not check method call validity. That is done later

PARAMETERS

- ``request`` - a django HttpRequest object
- ``request_format`` - the request type: 'json' or 'xml' 

RETURNS 

True if the request is valid and False if permission is denied

_is_xmlrpc_request(request)

source code 

Determines whether this request should be served by XMLRPC or JSONRPC

Returns true if this is an XML request and false for JSON

It is based on the following rules:

# If there is no post data, display documentation # content-type = text/xml or application/xml => XMLRPC # content-type contains json or javascript => JSONRPC # Try to parse as xml. Successful parse => XMLRPC # JSONRPC


Variables Details [hide private]

APPS

Value:
['expedient.clearinghouse.firstapp',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'django_extensions',
 'autoslug',
...