added get_section function to grab sections from sources.cfg
This commit is contained in:
parent
4f49e5cf8b
commit
96a7f5acd4
@ -1,6 +1,6 @@
|
|||||||
from scrapy import log
|
from scrapy import log
|
||||||
from scrapy.utils.project import get_project_settings
|
from scrapy.utils.project import get_project_settings
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
class Configurator:
|
class Configurator:
|
||||||
"""
|
"""
|
||||||
@ -47,3 +47,13 @@ class Configurator:
|
|||||||
log.start(logstdout=False, loglevel=log.DEBUG)
|
log.start(logstdout=False, loglevel=log.DEBUG)
|
||||||
else:
|
else:
|
||||||
log.start(logstdout=True, loglevel=log.WARNING)
|
log.start(logstdout=True, loglevel=log.WARNING)
|
||||||
|
|
||||||
|
def get_section(self, config, sourcename):
|
||||||
|
section = dict()
|
||||||
|
if config.has_section(sourcename):
|
||||||
|
section = dict(config.items(sourcename))
|
||||||
|
if 'reliability' not in section:
|
||||||
|
log.msg('Reliability not set for %s' % sourcename,
|
||||||
|
level=log.WARNING)
|
||||||
|
section['reliability'] = ''
|
||||||
|
return section
|
||||||
|
Reference in New Issue
Block a user