removed bastard injection from AirtimeApiClient
This commit is contained in:
parent
350c6e2f94
commit
9c74b0ea2c
|
@ -127,24 +127,6 @@ class RequestProvider(object):
|
||||||
|
|
||||||
|
|
||||||
class AirtimeApiClient(object):
|
class AirtimeApiClient(object):
|
||||||
|
|
||||||
# This is a little hacky fix so that I don't have to pass the config object
|
|
||||||
# everywhere where AirtimeApiClient needs to be initialized
|
|
||||||
default_config = None
|
|
||||||
# the purpose of this custom constructor is to remember which config file
|
|
||||||
# it was called with. So that after the initial call:
|
|
||||||
# AirtimeApiClient.create_right_config('/path/to/config')
|
|
||||||
# All subsequence calls to create_right_config will be with that config
|
|
||||||
# file
|
|
||||||
@staticmethod
|
|
||||||
def create_right_config(log=None,config_path=None):
|
|
||||||
if config_path: AirtimeApiClient.default_config = config_path
|
|
||||||
elif (not AirtimeApiClient.default_config):
|
|
||||||
raise ValueError("Cannot slip config_path attribute when it has \
|
|
||||||
never been passed yet")
|
|
||||||
return AirtimeApiClient( logger=None,
|
|
||||||
config_path=AirtimeApiClient.default_config )
|
|
||||||
|
|
||||||
def __init__(self, logger=None,config_path='/etc/airtime/api_client.cfg'):
|
def __init__(self, logger=None,config_path='/etc/airtime/api_client.cfg'):
|
||||||
if logger is None: self.logger = logging
|
if logger is None: self.logger = logging
|
||||||
else: self.logger = logger
|
else: self.logger = logger
|
||||||
|
|
Loading…
Reference in New Issue