-
-
Couldn't load subscription status.
- Fork 339
Open
Description
My own container depends on an other container that provides a ThreadSafeSingleton.
I would like my own container to provide this singleton as well, like a alias to the singleton.
E.g.
from dependency_injector import containers, providers
# Containers I can't update
class NestedOtherContainer(containers.DeclarativeContainer):
a_client = providers.ThreadSafeSingleton(...)
class OtherContainer(containers.DeclarativeContainer):
clients = providers.DependenciesContainer()
# my container
class MyContainer(containers.DeclarativeContainer):
other_container = providers.DependenciesContainer()
a_alias = ???I tried several things using Delegate like
a_alias = providers.Delegate(other_container.clients.a_client)
a_alias = providers.Delegate(other_container.clients.provided.a_client)
# etc.But none of them works when MyContainer(other_container=...).a_alias(), getting things like AttributeGetter or MethodCaller.
Any idea on how to do this kind of aliasing ?
Metadata
Metadata
Assignees
Labels
No labels