Decorators — Django RPC 0.1 documentation

### Navigation

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

# Decorators

`djangorpc.decorators.` `add_request_to_kwargs`(method)

  This is decorator for adding request to passed arguments. For example:

      class MainApiClass(object):

          @add_request_to_kwargs
          def func2(self, user, request):
              return Msg(u'func2')

`djangorpc.decorators.` `login_required`(method)

  This docorator add _pre_execute function for checking if user is authenticated:

      class MainApiClass(object):

          @login_required
          def func2(self, user):
              return Msg(u'func2')

`djangorpc.decorators.` `form_handler`(method)

  This decorator mark method as form handler. For example:

      class MainApiClass(object):

          @form_handler
          def submit(self, rdata, user):
              form = FeedbackForm(rdata)
              if form.is_valid():
                  form.send()
                  return Msg(u'Thank you for feedback.')
              else:
                  return Error(form.get_errors())

### Navigation

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