added check to CsvItemExporter

This commit is contained in:
Pablo Hoffman 2009-08-19 15:20:29 -03:00
parent 741a6d7863
commit f3c6d83ad3
1 changed files with 3 additions and 0 deletions

View File

@ -82,6 +82,9 @@ class CsvItemExporter(BaseItemExporter):
super(CsvItemExporter, self).__init__()
self.csv_writer = csv.writer(*args, **kwargs)
if self.include_headers_line:
if not self.fields_to_export:
raise RuntimeError("To use include_headers_line you must " \
"define fields_to_export attribute")
self.csv_writer.writerow(self.fields_to_export)
def export(self, item):