mirror of https://github.com/scrapy/scrapy.git
some other minor code cleanups for Settings class
This commit is contained in:
parent
90e6aefb4d
commit
02de8cb6fa
|
|
@ -14,10 +14,12 @@ class Settings(object):
|
|||
default_settings_module = 'scrapy.conf.default_settings'
|
||||
|
||||
def __init__(self):
|
||||
self.set_settings_module()
|
||||
self.defaults = {}
|
||||
self.global_defaults = import_(self.default_settings_module)
|
||||
self.disabled = os.environ.get('SCRAPY_SETTINGS_DISABLED', False)
|
||||
settings_module_path = os.environ.get('SCRAPYSETTINGS_MODULE', \
|
||||
'scrapy_settings')
|
||||
self.set_settings_module(settings_module_path)
|
||||
|
||||
# XXX: find a better solution for this hack
|
||||
pickled_settings = os.environ.get("SCRAPY_PICKLED_SETTINGS_TO_OVERRIDE")
|
||||
|
|
@ -35,10 +37,7 @@ class Settings(object):
|
|||
return self.defaults[opt_name]
|
||||
return getattr(self.global_defaults, opt_name, None)
|
||||
|
||||
def set_settings_module(self, settings_module_path=None):
|
||||
if settings_module_path is None:
|
||||
settings_module_path = os.environ.get('SCRAPYSETTINGS_MODULE', \
|
||||
'scrapy_settings')
|
||||
def set_settings_module(self, settings_module_path):
|
||||
self.settings_module_path = settings_module_path
|
||||
try:
|
||||
self.settings_module = import_(settings_module_path)
|
||||
|
|
|
|||
Loading…
Reference in New Issue