forked from platypush/platypush
Exposed _entities
utility property in Plugin
.
It can be used by other plugins to easily access the `entities` plugin, along the lines of `db` and `redis`.
This commit is contained in:
parent
68d8befa34
commit
a20065c649
1 changed files with 12 additions and 0 deletions
|
@ -91,6 +91,18 @@ class Plugin(EventGenerator, ExtensionWithManifest): # lgtm [py/missing-call-to
|
||||||
assert redis, 'db plugin not initialized'
|
assert redis, 'db plugin not initialized'
|
||||||
return redis
|
return redis
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _entities(self):
|
||||||
|
"""
|
||||||
|
:return: The reference to the :class:`platypush.plugins.entities.EntitiesPlugin`.
|
||||||
|
"""
|
||||||
|
from platypush.context import get_plugin
|
||||||
|
from platypush.plugins.entities import EntitiesPlugin
|
||||||
|
|
||||||
|
entities: EntitiesPlugin = get_plugin(EntitiesPlugin) # type: ignore
|
||||||
|
assert entities, 'entities plugin not initialized'
|
||||||
|
return entities
|
||||||
|
|
||||||
def run(self, method, *args, **kwargs):
|
def run(self, method, *args, **kwargs):
|
||||||
assert (
|
assert (
|
||||||
method in self.registered_actions
|
method in self.registered_actions
|
||||||
|
|
Loading…
Reference in a new issue