提交 02de8cb6 编写于 作者: P Pablo Hoffman

some other minor code cleanups for Settings class

上级 90e6aefb
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册