Skip to content

How can a list element in a Configuration provider be injected? #274

@clifflau1120

Description

@clifflau1120

Hello,

I have quite a nested configuration file that contains a lot of lists.
I would like to inject a specific element into a provider, which would look like:

config = providers.Configuration(defaults={'index': 0, 'items': list('a', 'b', 'c')})

foo= providers.Factory(Foo, item=config.items[config.index])

However, I was prompted:

TypeError: 'dependency_injector.providers.Configuration' object is not subscriptable

Anyone has idea about this? Thank you.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions