fix issues identified in review

This commit is contained in:
colinmorris 2017-10-31 18:08:47 -04:00
parent 8a7552370d
commit 23e571e860
1 changed files with 2 additions and 2 deletions

View File

@ -49,14 +49,14 @@ value of one of their fields::
self.year_to_exporter = {}
def close_spider(self, spider):
for exporter in self.year_to_exporter.itervalues():
for exporter in self.year_to_exporter.values():
exporter.finish_exporting()
exporter.file.close()
def _exporter_for_item(self, item):
year = item['year']
if year not in self.year_to_exporter:
f = open('{}.xml'.format(year), 'w+b')
f = open('{}.xml'.format(year), 'wb')
exporter = XmlItemExporter(f)
exporter.start_exporting()
self.year_to_exporter[year] = exporter