1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
.. _ref-rpc:
.. module:: trytond.rpc
RPC
===
.. class:: RPC([readonly[, instantiate[, [decorator, result[, check_access[, unique[, fresh_session[, cache]]]]]]]])
Define the behavior of Remote Procedure Call.
Instance attributes are:
.. attribute:: RPC.readonly
The transaction mode
.. attribute:: RPC.instantiate
The position or the slice of the argument to be instanciated
.. attribute:: RPC.decorator
The function to decorate the called procedure with
.. attribute:: RPC.result
The function to transform the result
.. attribute:: RPC.check_access
Set ``_check_access`` in the context to activate the access right on model
and field.
Default is ``True``.
.. attribute:: RPC.unique
If set, it ensures the instantiated records are unique.
Default is ``True``.
.. attribute:: RPC.fresh_session
If set, it requires a fresh session.
Default is ``False``.
.. attribute:: RPC.cache
A :class:`RPCCache` instance to compute the cache duration for the answer.
RPCCache
--------
.. class:: RPCCache([days[, seconds])
Define cache duration of RPC result.
Instance attributes are:
.. attribute:: RPC.duration
A :py:class:`datetime.timedelta` instance.
Instance methods are:
.. method:: RCP.headers
Return a dictionary of the headers.
Exceptions
==========
.. exception:: RPCReturnException
The base class of exceptions to return the result of ``result`` method
instead of raising an exception.
The :class:`~trytond.transaction.Transaction` is rollbacked and tasks are
cleared.
|