Magellan Linux

Contents of /trunk/docutils/patches/docutils-0.4-python2.5.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 437 - (show annotations) (download)
Tue Jan 1 15:54:43 2008 UTC (16 years, 4 months ago) by niro
File size: 4672 byte(s)
-some patches for docutils-0.4-r1

1 Index: test/alltests.py
2 ===================================================================
3 --- test/alltests.py (revision 4628)
4 +++ test/alltests.py (revision 4631)
5 @@ -19,21 +19,10 @@
6
7 import sys
8 import os
9 -from types import UnicodeType
10 import DocutilsTestSupport # must be imported before docutils
11 import docutils
12
13
14 -def new_exception_str(self):
15 - for i in self.args:
16 - if isinstance(i, UnicodeType):
17 - raise RuntimeError('Error (unicode): %r' % (self.args,))
18 - return old_exception_str(self)
19 -
20 -old_exception_str = Exception.__str__
21 -Exception.__str__ = new_exception_str
22 -
23 -
24 class Tee:
25
26 """Write to a file and a stream (default: stdout) simultaneously."""
27 Index: test/test_parsers/test_rst/test_directives/test_images.py
28 ===================================================================
29 --- test/test_parsers/test_rst/test_directives/test_images.py (revision 4628)
30 +++ test/test_parsers/test_rst/test_directives/test_images.py (revision 4631)
31 @@ -245,11 +245,11 @@
32 <paragraph>
33 Error in "image" directive:
34 invalid option value: (option: "scale"; value: 'fifty')
35 - invalid literal for int(): fifty.
36 + %s.
37 <literal_block xml:space="preserve">
38 .. image:: picture.png
39 :scale: fifty
40 -"""],
41 +""" % DocutilsTestSupport.exception_data('int("fifty")')[1][0]],
42 ["""\
43 .. image:: picture.png
44 :scale: 50
45 Index: test/test_parsers/test_rst/test_directives/test_contents.py
46 ===================================================================
47 --- test/test_parsers/test_rst/test_directives/test_contents.py (revision 4628)
48 +++ test/test_parsers/test_rst/test_directives/test_contents.py (revision 4631)
49 @@ -151,11 +151,11 @@
50 <paragraph>
51 Error in "contents" directive:
52 invalid option value: (option: "depth"; value: 'two')
53 - invalid literal for int(): two.
54 + %s.
55 <literal_block xml:space="preserve">
56 .. contents::
57 :depth: two
58 -"""],
59 +""" % DocutilsTestSupport.exception_data('int("two")')[1][0]],
60 ["""\
61 .. contents::
62 :width: 2
63 Index: test/test_parsers/test_rst/test_directives/test_tables.py
64 ===================================================================
65 --- test/test_parsers/test_rst/test_directives/test_tables.py (revision 4628)
66 +++ test/test_parsers/test_rst/test_directives/test_tables.py (revision 4631)
67 @@ -34,6 +34,16 @@
68 else:
69 unichr_exception_string = str(unichr_exception)
70
71 +null_bytes_code = """
72 +import csv
73 +import cStringIO
74 +csv_data = open('%s', 'rb').read().decode('latin-1')
75 +csv_file = cStringIO.StringIO(csv_data)
76 +reader = csv.reader(csv_file)
77 +reader.next()
78 +""" % utf_16_csv
79 +null_bytes_exception = DocutilsTestSupport.exception_data(null_bytes_code)[1][0]
80 +
81 totest = {}
82
83 totest['table'] = [
84 @@ -549,7 +559,7 @@
85 <paragraph>
86 Error in "csv-table" directive:
87 invalid option value: (option: "widths"; value: '10,y,z')
88 - invalid literal for int(): y.
89 + %s.
90 <literal_block xml:space="preserve">
91 .. csv-table:: bad column widths
92 :widths: 10,y,z
93 @@ -565,7 +575,7 @@
94 :widths: 0 0 0
95 \n\
96 some, csv, data
97 -"""],
98 +""" % DocutilsTestSupport.exception_data('int("y")')[1][0]],
99 ["""\
100 .. csv-table:: good delimiter
101 :delim: /
102 @@ -734,14 +744,14 @@
103 <system_message level="3" line="1" source="test data" type="ERROR">
104 <paragraph>
105 Error with CSV data in "csv-table" directive:
106 - string with NUL bytes
107 + %s
108 <literal_block xml:space="preserve">
109 .. csv-table:: bad encoding
110 :file: %s
111 :encoding: latin-1
112 <paragraph>
113 (7- and 8-bit text encoded as UTF-16 has lots of null/zero bytes.)
114 -""" % utf_16_csv],
115 +""" % (null_bytes_exception, utf_16_csv)],
116 ["""\
117 .. csv-table:: good encoding
118 :file: %s
119 Index: docutils/parsers/rst/directives/tables.py
120 ===================================================================
121 --- docutils/parsers/rst/directives/tables.py (revision 4628)
122 +++ docutils/parsers/rst/directives/tables.py (revision 4631)
123 @@ -259,7 +259,8 @@
124
125 def parse_csv_data_into_rows(csv_data, dialect, source, options):
126 # csv.py doesn't do Unicode; encode temporarily as UTF-8
127 - csv_reader = csv.reader([line.encode('utf-8') for line in csv_data],
128 + csv_reader = csv.reader([(line.encode('utf-8') + '\n')
129 + for line in csv_data],
130 dialect=dialect)
131 rows = []
132 max_cols = 0