mirror of https://gitlab.com/bashrc2/epicyon
csv encoding
parent
ef606161a1
commit
35a1a3ecc9
|
@ -10800,8 +10800,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.httpPrefix,
|
self.server.httpPrefix,
|
||||||
self.server.domainFull,
|
self.server.domainFull,
|
||||||
self.path)
|
self.path)
|
||||||
msg = json.dumps(catalogStr,
|
msg = msg.encode('utf-8')
|
||||||
ensure_ascii=False).encode('utf-8')
|
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/csv',
|
self._set_headers('text/csv',
|
||||||
msglen, None, callingDomain)
|
msglen, None, callingDomain)
|
||||||
|
|
|
@ -963,7 +963,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
|
||||||
return ''
|
return ''
|
||||||
csvStr = \
|
csvStr = \
|
||||||
'id,type,hasType,startDate,expiryDate,' + \
|
'id,type,hasType,startDate,expiryDate,' + \
|
||||||
'quantity,price,currency,Image,description,\r\n'
|
'quantity,price,currency,Image,description,\n'
|
||||||
for item in catalogJson['DFC:supplies']:
|
for item in catalogJson['DFC:supplies']:
|
||||||
csvStr += '"' + item['@id'] + '",'
|
csvStr += '"' + item['@id'] + '",'
|
||||||
csvStr += '"' + item['@type'] + '",'
|
csvStr += '"' + item['@type'] + '",'
|
||||||
|
@ -975,7 +975,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
|
||||||
csvStr += '"' + item['DFC:price'].split(' ')[1] + '",'
|
csvStr += '"' + item['DFC:price'].split(' ')[1] + '",'
|
||||||
csvStr += '"' + item['DFC:Image'] + '",'
|
csvStr += '"' + item['DFC:Image'] + '",'
|
||||||
description = item['DFC:description'].replace('"', "'")
|
description = item['DFC:description'].replace('"', "'")
|
||||||
csvStr += '"' + description + '",\r\n'
|
csvStr += '"' + description + '",\n'
|
||||||
return csvStr
|
return csvStr
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue