Files
tryton/trytond/doc/ref/rpc.rst
T

78 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2012-09-24 22:16:53 +02:00
.. _ref-rpc:
.. module:: trytond.rpc
RPC
===
2023-10-28 00:16:32 +02:00
.. class:: RPC([readonly[, instantiate[, [decorator, result[, check_access[, unique[, fresh_session[, cache]]]]]]]])
2012-09-24 22:16:53 +02:00
2022-03-27 16:06:09 +02:00
Define the behavior of Remote Procedure Call.
2012-09-24 22:16:53 +02:00
Instance attributes are:
.. attribute:: RPC.readonly
2022-03-27 16:06:09 +02:00
The transaction mode
2012-09-24 22:16:53 +02:00
.. attribute:: RPC.instantiate
2022-03-27 16:06:09 +02:00
The position or the slice of the argument to be instanciated
2012-09-24 22:16:53 +02:00
2023-08-16 10:39:16 +02:00
.. attribute:: RPC.decorator
The function to decorate the called procedure with
2012-09-24 22:16:53 +02:00
.. attribute:: RPC.result
2022-03-27 16:06:09 +02:00
The function to transform the result
2014-09-17 21:43:53 +02:00
.. attribute:: RPC.check_access
2022-03-27 16:06:09 +02:00
Set ``_check_access`` in the context to activate the access right on model
and field.
Default is ``True``.
2018-07-16 14:49:34 +02:00
.. attribute:: RPC.unique
2022-03-27 16:06:09 +02:00
If set, it ensures the instantiated records are unique.
Default is ``True``.
2018-08-26 18:04:05 +02:00
.. attribute:: RPC.fresh_session
2022-03-27 16:06:09 +02:00
If set, it requires a fresh session.
Default is ``False``.
2019-04-08 10:10:40 +02:00
.. attribute:: RPC.cache
2022-03-27 16:06:09 +02:00
A :class:`RPCCache` instance to compute the cache duration for the answer.
2019-04-08 10:10:40 +02:00
RPCCache
2022-03-27 16:06:09 +02:00
--------
2019-04-08 10:10:40 +02:00
.. class:: RPCCache([days[, seconds])
2022-03-27 16:06:09 +02:00
Define cache duration of RPC result.
2019-04-08 10:10:40 +02:00
Instance attributes are:
.. attribute:: RPC.duration
2022-04-06 18:19:49 +02:00
A :py:class:`datetime.timedelta` instance.
2019-04-08 10:10:40 +02:00
Instance methods are:
.. method:: RCP.headers
2022-03-27 16:06:09 +02:00
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.