redirectory.libs_int.importers.csv_importer module¶
CSV Importer¶
The CSV Importer takes care of importing CSV files containing Redirect Rules and adding them into the SQL database of the management pod.
The behaviour:
- If a rule in the CSV already exists it is going to be ignored.
- If a syntax/parsing error occurs somewhere in the CSV file the whole import is marked as failed and all of the changes to the database are roll backed.
-
class
redirectory.libs_int.importers.csv_importer.
CSVImporter
(csv_byte_file_in: werkzeug.datastructures.FileStorage)[source]¶ Bases:
object
A new CSVImporter is created for every import and the data of the CSV file is passed as a parameter in the constructor of the class.
-
csv_reader
= None¶ Reader object used to parse the CSV file
-
data_template
= {'destination': None, 'destination_is_rewrite': None, 'domain': None, 'domain_is_regex': None, 'path': None, 'path_is_regex': None, 'weight': None}¶ This is the template that the CSV is checked against. Every row of the CSV must match this template otherwise the whole import will fail
-