Base classes — Django RPC 0.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Django RPC 0.1 documentation »
- API Guide »

# Base classes

class `djangorpc.` `RpcRouter`(url, actions={}, enable_buffer=True)

  Bases: `object`

  Router class for RPC.

  Parameters: | url – URL pattern name or something you can pass to `reverse`. Used to get URL which router is connected. actions – Action classes router should add to RPC API enable_buffer – Define client should send requests in a butch

  `action_extra_kwargs`(action, request, *args, **kwargs)

    Check maybe this action get some extra arguments from request

  `method_extra_kwargs`(method, request, *args, **kwargs)

    Check maybe this method get some extra arguments from request

  `extra_kwargs`(request, *args, **kwargs)

    For all method in ALL actions we add request.user to arguments. You can add something else, request for example. For adding extra arguments for one action use action_extra_kwargs.

  `api`(request, *args, **kwargs)

    This method is view that send js for provider initialization. Just set this in template after RPC scripts including: <script src=”{% url api_url_name %}”></script>

  `call_action`(rd, request, *args, **kwargs)

    This method checks parameters of RPC request and call method of action. It checks arguments number, method existing, handle RpcExceptionEvent and send exception event for RPC.

class `djangorpc.` `RpcRouterJSONEncoder`(url_args, url_kwargs, *args, **kwargs)

  Bases: `simplejson.encoder.JSONEncoder`

  JSON Encoder for RpcRouter

### Navigation

- index
- modules |
- next |
- previous |
- Django RPC 0.1 documentation »
- API Guide »