Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit 1020da6

Browse files
committed
fixed registration failure
1 parent 3222358 commit 1020da6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tgt_grease/core/InversionOfControl.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
class GreaseContainer(object):
1010
"""Inversion of Control Container for objects in GREASE"""
1111

12-
__logger = Logging()
13-
__mongo = Mongo(__logger.getConfig())
14-
1512

1613
def __init__(self, *args, **kwargs):
1714
if args or kwargs:
1815
self.getLogger().warning(
1916
"Passing instances of Logger to the IOC is deprecated. Please just use getLogger().", verbose=True
2017
)
18+
self.__logger = None
19+
self.__mongo = None
2120

2221
def getLogger(self):
2322
"""Get the logging instance
@@ -27,7 +26,10 @@ def getLogger(self):
2726
2827
"""
2928

30-
return GreaseContainer.__logger
29+
if not isinstance(self.__logger, Logging):
30+
self.__logger = Logging()
31+
32+
return self.__logger
3133

3234
def getNotification(self):
3335
"""Get the notifications instance
@@ -46,7 +48,10 @@ def getMongo(self):
4648
4749
"""
4850

49-
return GreaseContainer.__mongo
51+
if not isinstance(self.__mongo, Mongo):
52+
self.__mongo = Mongo(self.getLogger().getConfig())
53+
54+
return self.__mongo
5055

5156
def getCollection(self, collectionName):
5257
"""Get a collection object from MongoDB

0 commit comments

Comments
 (0)