mirror of
https://gitlab.com/bashrc2/epicyon
synced 2026-11-04 19:52:33 +00:00
csv encoding
This commit is contained in:
1 parent
ef606161a1
commit
35a1a3ecc9
2 files changed
+3
-4
No files matched your search
@@ -10800,8 +10800,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||
self.server.httpPrefix,
|
||||
self.server.domainFull,
|
||||
self.path)
|
||||
msg = json.dumps(catalogStr,
|
||||
ensure_ascii=False).encode('utf-8')
|
||||
msg = msg.encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/csv',
|
||||
msglen, None, callingDomain)
|
||||
|
||||
@@ -963,7 +963,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
|
||||
return ''
|
||||
csvStr = \
|
||||
'id,type,hasType,startDate,expiryDate,' + \
|
||||
'quantity,price,currency,Image,description,\r\n'
|
||||
'quantity,price,currency,Image,description,\n'
|
||||
for item in catalogJson['DFC:supplies']:
|
||||
csvStr += '"' + item['@id'] + '",'
|
||||
csvStr += '"' + item['@type'] + '",'
|
||||
@@ -975,7 +975,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
|
||||
csvStr += '"' + item['DFC:price'].split(' ')[1] + '",'
|
||||
csvStr += '"' + item['DFC:Image'] + '",'
|
||||
description = item['DFC:description'].replace('"', "'")
|
||||
csvStr += '"' + description + '",\r\n'
|
||||
csvStr += '"' + description + '",\n'
|
||||
return csvStr
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user