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

98 lines
2.0 KiB
ReStructuredText
Raw Normal View History

2012-04-21 01:21:41 +02:00
.. _ref-pool:
.. module:: trytond.pool
Pool
====
.. class:: Pool([database_name])
2022-03-27 16:06:09 +02:00
Store the instances of :class:`~trytond.model.Model`,
2022-04-06 18:19:49 +02:00
:class:`~trytond.wizard.Wizard` and *Report* per database.
2012-04-21 01:21:41 +02:00
Static methods:
2018-03-20 17:27:12 +01:00
.. staticmethod:: Pool.register(klass, ..., type_, module[, depends])
2012-04-21 01:21:41 +02:00
2022-03-27 16:06:09 +02:00
Register the classes of type (``model``, ``report`` or ``wizard``) for the
module.
If ``depends`` is set, the registration happens only if all the modules are
activated.
2012-04-21 01:21:41 +02:00
2018-01-12 15:46:52 +01:00
.. staticmethod:: Pool.register_mixin(mixin, classinfo, module)
2022-03-27 16:06:09 +02:00
Register the mixin for the module.
The ``mixin`` are included to all subclasses of ``classinfo``.
2018-01-12 15:46:52 +01:00
2012-04-21 01:21:41 +02:00
Class methods:
.. classmethod:: Pool.start()
2022-03-27 16:06:09 +02:00
Start the pool by registering all Tryton modules found.
2012-04-21 01:21:41 +02:00
.. classmethod:: Pool.stop(database_name)
2022-03-27 16:06:09 +02:00
Stop the pool by removing instances for the database.
2012-04-21 01:21:41 +02:00
.. classmethod:: Pool.database_list()
2022-03-27 16:06:09 +02:00
List all started databases.
2012-04-21 01:21:41 +02:00
Instance methods:
.. method:: Pool.get(name[, type])
2022-03-27 16:06:09 +02:00
Return the named object of ``type`` from the pool.
2012-04-21 01:21:41 +02:00
.. method:: Pool.iterobject([type])
2022-03-27 16:06:09 +02:00
Return an interator over objects of ``type``.
2012-09-24 22:16:53 +02:00
2018-03-20 17:27:12 +01:00
.. method:: Pool.fill(module, modules)
2012-09-24 22:16:53 +02:00
2022-03-27 16:06:09 +02:00
Fill the pool with the registered classes from the module and for the
activated modules and return a list of classes for each type in a
dictionary.
2016-03-17 22:56:58 +01:00
.. method:: Pool.setup([classes])
2022-03-27 16:06:09 +02:00
Call all setup methods of the classes provided or for all the registered
classes.
2012-09-24 22:16:53 +02:00
.. method:: Pool.setup_mixin([type[, name]])
2018-01-12 15:46:52 +01:00
Include all the mixin registered for the filled modules to the corresponding
registered type of classes or named.
2022-03-27 16:06:09 +02:00
2018-01-12 15:46:52 +01:00
2012-09-24 22:16:53 +02:00
PoolMeta
2022-03-27 16:06:09 +02:00
--------
2012-09-24 22:16:53 +02:00
.. class:: PoolMeta
2022-03-27 16:06:09 +02:00
A metaclass helper to setup __name__ on class to be registered in the
:class:`Pool`.
PoolBase
2022-03-27 16:06:09 +02:00
--------
.. class:: PoolBase
2022-03-27 16:06:09 +02:00
The base class of registered classes.
Class methods:
.. classmethod:: PoolBase.__setup__()
Setup the class.
2022-04-06 18:19:49 +02:00
.. classmethod:: PoolBase.__post_setup__()
2022-03-27 16:06:09 +02:00
Post setup the class.
.. classmethod:: PoolBase.__register__()
Registare the class.