feat: Add quoting parameter in the UnicodeWriter constructor (#12578)

* Add quoting parameter in the constructor

* fix: Use quoting kwarg to pass quoting value

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
This commit is contained in:
Britlog 2021-03-17 13:50:20 +01:00 committed by GitHub
parent ee1806828f
commit 662f409604
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,10 +107,10 @@ def build_csv_response(data, filename):
frappe.response["type"] = "csv"
class UnicodeWriter:
def __init__(self, encoding="utf-8"):
def __init__(self, encoding="utf-8", quoting=csv.QUOTE_NONNUMERIC):
self.encoding = encoding
self.queue = StringIO()
self.writer = csv.writer(self.queue, quoting=csv.QUOTE_NONNUMERIC)
self.writer = csv.writer(self.queue, quoting=quoting)
def writerow(self, row):
if six.PY2: