Update export json and csv for Python 2

This commit is contained in:
JonnyWong16 2020-08-04 12:13:47 -07:00
parent ed454b2a4a
commit 6fb3a3a3c8
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 8 additions and 17 deletions

View file

@ -19,10 +19,10 @@ from __future__ import unicode_literals
from future.builtins import next
from future.builtins import object
from future.builtins import str
from backports import csv
from io import open
import base64
import csv
import json
import linecache
import os
@ -6538,8 +6538,8 @@ class WebInterface(object):
return serve_file(exporter.get_export_filepath(result['filename']), name=result['filename'],
content_type='application/json')
elif result['file_format'] == 'csv':
with open(exporter.get_export_filepath(result['filename']), 'r', encoding='utf-8') as f:
reader = csv.DictReader(f)
with open(exporter.get_export_filepath(result['filename']), 'r', encoding='utf-8') as infile:
reader = csv.DictReader(infile)
table = '<table><tr><th>' + \
'</th><th>'.join(reader.fieldnames) + \
'</th></tr><tr>' + \