Archived
1
0

Edited the documentation of the functions in the configurator

This commit is contained in:
Jip J. Dekker 2014-06-08 12:46:50 +02:00
parent 90129f41cc
commit d765e7fce4

View File

@ -8,28 +8,30 @@ class Configurator:
self.scrapy_settings = get_project_settings()
def set_output(self, filename, format):
def set_output(self, filename, fileformat):
"""
This function manipulates the Scrapy settings that normally would be set in the settings file. In the Fourmi
project these are command line arguments.
:param docopt_arguments: A dictionary generated by docopt containing all CLI arguments.
This function manipulates the Scrapy output file settings that normally would be set in the settings file.
In the Fourmi project these are command line arguments.
:param filename: The filename of the file where the output will be put.
:param fileformat: The format in which the output will be.
"""
if filename != 'result.*format*':
self.scrapy_settings.overrides["FEED_URI"] = format
elif format == "jsonlines":
self.scrapy_settings.overrides["FEED_URI"] = fileformat
elif fileformat == "jsonlines":
self.scrapy_settings.overrides["FEED_URI"] = "results.json"
elif format is not None:
self.scrapy_settings.overrides["FEED_URI"] = "results." + format
elif fileformat is not None:
self.scrapy_settings.overrides["FEED_URI"] = "results." + fileformat
if format is not None:
self.scrapy_settings.overrides["FEED_FORMAT"] = format
if fileformat is not None:
self.scrapy_settings.overrides["FEED_FORMAT"] = fileformat
def start_log(self, logfile, verbose):
"""
This function starts the logging functionality of Scrapy using the settings given by the CLI.
:param docopt_arguments: A dictionary generated by docopt containing all CLI arguments.
:param logfile: The location where the logfile will be saved.
:param verbose: A boolean value to switch between loglevels.
"""
if logfile is not None:
if verbose: