changeset 3340:afef9c8b2ed2

parser.text_csv: added Sniffer for delimiter
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 19 Mar 2008 18:46:34 +0100
parents a07ac5a0811e
children 24690a4045df 38cbacf3cbc4
files MoinMoin/parser/text_csv.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_csv.py	Wed Mar 19 18:31:01 2008 +0100
+++ b/MoinMoin/parser/text_csv.py	Wed Mar 19 18:46:34 2008 +0100
@@ -28,7 +28,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from csv import reader, QUOTE_NONE, QUOTE_MINIMAL
+from csv import reader, QUOTE_NONE, QUOTE_MINIMAL, Sniffer
 
 from MoinMoin.util.dataset import TupleDataset, Column
 from MoinMoin.widget.browser import DataBrowserWidget
@@ -54,6 +54,7 @@
 
         # workaround csv.reader deficiency by encoding to utf-8
         data = raw.encode('utf-8').split('\n')
+        delimiter = Sniffer().sniff(data[0]).delimiter
 
         visible = None
         hiddenindexes = []
@@ -62,7 +63,6 @@
         staticcols = []
         staticvals = []
         linkcols = []
-        delimiter = ';'
         quotechar = '\x00' # can't be entered
         quoting = QUOTE_NONE
         name = None