mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
csv importer: mimic messytables defaults for now
This commit is contained in:
parent
2544736aa8
commit
57c8f9f4fe
@ -108,6 +108,9 @@ def _guess_dialect(file_obj):
|
|||||||
# Restrict allowed delimiters to prevent guessing other char than this list.
|
# Restrict allowed delimiters to prevent guessing other char than this list.
|
||||||
dialect = csv.Sniffer().sniff(file_obj.read(100000), delimiters=['\t', ',', ';', '|'])
|
dialect = csv.Sniffer().sniff(file_obj.read(100000), delimiters=['\t', ',', ';', '|'])
|
||||||
log.info("Guessed dialect %s" % dict(dialect.__dict__))
|
log.info("Guessed dialect %s" % dict(dialect.__dict__))
|
||||||
|
# Mimic messytables default for now.
|
||||||
|
dialect.lineterminator = "\n"
|
||||||
|
dialect.doublequote = True
|
||||||
return dialect
|
return dialect
|
||||||
except csv.Error:
|
except csv.Error:
|
||||||
log.info("Cannot guess dialect using Excel as fallback.")
|
log.info("Cannot guess dialect using Excel as fallback.")
|
||||||
|
Loading…
Reference in New Issue
Block a user