yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #75488
[Bug 1180136] Re: Dependency injection framework is constructing the object first and then injecting the dependency which is incorrect
Dependency Injection was removed/reworked. This is no longer an issue.
** Changed in: keystone
Status: Triaged => Won't Fix
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1180136
Title:
Dependency injection framework is constructing the object first and
then injecting the dependency which is incorrect
Status in OpenStack Identity (keystone):
Won't Fix
Bug description:
Dependency injection framework is constructing the object first and
then injecting the dependency which is incorrect.
def requires(*dependencies):
"""Inject specified dependencies from the registry into the instance."""
def wrapper(self, *args, **kwargs):
"""Inject each dependency from the registry."""
self.__wrapped_init__(*args, **kwargs) ----------------------> Constructs object First
for dependency in self._dependencies: ----------------------> Inject dependency Second
if dependency not in REGISTRY:
raise UnresolvableDependencyException(dependency)
setattr(self, dependency, REGISTRY[dependency])
It would be better to inject the dependency first and then construct
the object, so that the dependency is available during object
construction.
To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1180136/+subscriptions