From 16799e414b09dbb7d268ed1e35b1fd8c61f2ac37 Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Wed, 25 Feb 2015 01:48:51 +0200 Subject: [PATCH] Refactoring of ProviderDelegate --- VERSION | 2 +- objects/providers.py | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 267577d4..2b7c5ae0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.1 +0.4.2 diff --git a/objects/providers.py b/objects/providers.py index 1672e403..4e7b2a57 100644 --- a/objects/providers.py +++ b/objects/providers.py @@ -41,7 +41,28 @@ class Provider(object): """ Returns provider delegate. """ - return self.__call__ + return ProviderDelegate(self) + + +class ProviderDelegate(Provider): + """ + Provider's delegate. + """ + + def __init__(self, delegated): + """ + Initializer. + + :type delegated: Provider + """ + self.delegated = delegated + super(ProviderDelegate, self).__init__() + + def __call__(self): + """ + Returns provided instance. + """ + return self.delegated.__call__ def prepare_injections(injections):