Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate cannot be used now in the overridden container in v3.14.11 #235

Closed
GitterRemote opened this issue Oct 9, 2019 · 3 comments
Closed
Assignees
Labels

Comments

@GitterRemote
Copy link

@GitterRemote GitterRemote commented Oct 9, 2019

import collections                                                                 
from dependency_injector import containers                                         
from dependency_injector import providers                                          
                                                                                   
                                                                                   
A = collections.namedtuple('A', [])                                                
B = collections.namedtuple('B', ['fa'])                                            
C = collections.namedtuple('B', ['a'])  


class Services(containers.DeclarativeContainer):                                   
    a = providers.Dependency()                                                     
    c = providers.Factory(C, a=a)                                                  
    b = providers.Factory(B, fa=a.delegate())                                      
                                                                                   
                                                                                   
a = providers.Factory(A)                                                           
assert isinstance(Services(a=a).c().a, A)  # ok                                    
Services(a=a).b().fa()  # error: dependency_injector.errors.Error: Dependency is not defined
@GitterRemote GitterRemote changed the title Delegate cannot be used now in container in v3.14.11 Delegate cannot be used now in the overridden container in v3.14.11 Oct 9, 2019
@rmk135 rmk135 self-assigned this Oct 9, 2019
@rmk135 rmk135 added the bug label Oct 9, 2019
@rmk135
Copy link
Member

@rmk135 rmk135 commented Oct 9, 2019

Looking on it...

@rmk135
Copy link
Member

@rmk135 rmk135 commented Oct 9, 2019

Ok, I found it. Delegate provided was inherited from Object and got affected by v3.14.11 changes.

Fix will come during the day.

rmk135 added a commit that referenced this issue Oct 9, 2019
rmk135 added a commit that referenced this issue Oct 9, 2019
* Add test for bug #235

* Fix issue + refactoring

* Update changelog
@rmk135
Copy link
Member

@rmk135 rmk135 commented Oct 9, 2019

Fix is published in 3.14.12.

@GitterRemote , thanks a lot for reporting the issue.

Roman

@rmk135 rmk135 closed this Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants