- record[key] = csv_prepare(record[key])
- toret += u','.join([record[key] for key in keys]) + '\n'
- toret += '\n\n'
+ if isinstance(record[key], basestring):
+ pass
+ elif isinstance(record[key], bool):
+ record[key] = 'tak' if record[key] else 'nie'
+ elif isinstance(record[key], (list, tuple)) and all(isinstance(v, basestring) for v in record[key]):
+ record[key] = ', '.join(record[key])
+ else:
+ record[key] = json.dumps(record[key])
+
+ csv_writer.writerow([record[key] for key in keys])
+ csv_writer.writerow([])