summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2013-05-16 20:38:43 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2013-05-16 20:38:43 +0000
commitf68f0da3eb5556640e8f4e64d8b49cb87959b954 (patch)
tree91178692b49af0515c193ccd408c2011b2d9a105
parentdd795c63c08c8d381145fe3f15081335d64b94e1 (diff)
downloaddocutils-f68f0da3eb5556640e8f4e64d8b49cb87959b954.tar.gz
Fix [ 210 ] Python 3.3 checks CVS syntax only if "strict" is True.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7662 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--HISTORY.txt4
-rw-r--r--docutils/parsers/rst/directives/tables.py2
-rwxr-xr-xtest/test_parsers/test_rst/test_directives/test_tables.py14
3 files changed, 15 insertions, 5 deletions
diff --git a/HISTORY.txt b/HISTORY.txt
index caf27367c..82dd9112c 100644
--- a/HISTORY.txt
+++ b/HISTORY.txt
@@ -35,6 +35,10 @@ Changes Since 0.10
- Apply [ 3599485 ] node source/line information for sphinx translation.
+* docutils/parsers/rst/directives/tables.py
+
+ - Fix [ 210 ] Python 3.3 checks CVS syntax only if "strict" is True.
+
* docutils/parsers/rst/states.py
- Fix [ 157 ] Line block parsing doesn't like system message.
diff --git a/docutils/parsers/rst/directives/tables.py b/docutils/parsers/rst/directives/tables.py
index 0758f82e5..f17e76e6f 100644
--- a/docutils/parsers/rst/directives/tables.py
+++ b/docutils/parsers/rst/directives/tables.py
@@ -164,6 +164,7 @@ class CSVTable(Table):
quotechar = '"'
doublequote = True
skipinitialspace = True
+ strict = True
lineterminator = '\n'
quoting = csv.QUOTE_MINIMAL
@@ -189,6 +190,7 @@ class CSVTable(Table):
escapechar = '\\'
doublequote = False
skipinitialspace = True
+ strict = True
lineterminator = '\n'
quoting = csv.QUOTE_MINIMAL
diff --git a/test/test_parsers/test_rst/test_directives/test_tables.py b/test/test_parsers/test_rst/test_directives/test_tables.py
index 924cf7793..e0b378554 100755
--- a/test/test_parsers/test_rst/test_directives/test_tables.py
+++ b/test/test_parsers/test_rst/test_directives/test_tables.py
@@ -10,7 +10,7 @@ Tests for tables.py directives.
from __init__ import DocutilsTestSupport
-import os
+import os, sys
import csv
from docutils.parsers.rst.directives import tables
@@ -32,6 +32,10 @@ if isinstance(unichr_exception, OverflowError):
else:
unichr_exception_string = str(unichr_exception)
+csv_eod_error_str = "unexpected end of data"
+if sys.version_info < (3,3):
+ csv_eod_error_str = "newline inside string"
+
def null_bytes():
import csv
csv_data = open(utf_16_csv, 'rb').read()
@@ -760,12 +764,12 @@ u"""\
<system_message level="3" line="1" source="test data" type="ERROR">
<paragraph>
Error with CSV data in "csv-table" directive:
- newline inside string
+ %s
<literal_block xml:space="preserve">
.. csv-table:: bad CSV data
\n\
"bad", \"csv, data
-"""],
+""" % csv_eod_error_str],
["""\
.. csv-table:: bad CSV header data
:header: "bad", \"csv, data
@@ -777,13 +781,13 @@ u"""\
<system_message level="3" line="1" source="test data" type="ERROR">
<paragraph>
Error with CSV data in "csv-table" directive:
- newline inside string
+ %s
<literal_block xml:space="preserve">
.. csv-table:: bad CSV header data
:header: "bad", \"csv, data
\n\
good, csv, data
-"""],
+""" % csv_eod_error_str],
["""\
.. csv-table:: bad encoding
:file: %s