Commit 2759f04
committed
Fix string/bytes issues under python 3.
1) cgi/client.py: override cgi.FieldStorage's make_file so that file
is always created in binary/byte mode. This means that json (and
xml) are bytes not strings.
2) rest.py: try harder to find dicttoxml in roundup directory or on
sys.path. This just worked under python 2 but python 3 only
searches sys.path by default and does not search relative like
python 2.
3) rest.py: replace headers.getheader call removed from python 3 with
equivalent code.
4) rest.py: make value returned from dispatch into bytes not string.
5) test/caseinsensitivedict.py, test/test_CaseInsensitiveDict.py:
get code from stackoverflow that implements a case insensitive key
dict. So dict['foo'], dict['Foo'] are the same entry. Used for
looking up headers in mocked http rewuset header array.
6) test/rest_common.py: rework tests for etags and rest to properly
supply bytes to the called routines. Calls to s2b and b2s and use
of BytesIO and overriding make_file in cgi.FieldStorage to try to
make sure it works under python 3.1 parent 67f82b5 commit 2759f04
File tree
4 files changed
+168
-66
lines changed- roundup
- cgi
- test
4 files changed
+168
-66
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
378 | 388 | | |
| 389 | + | |
379 | 390 | | |
380 | 391 | | |
381 | 392 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
163 | | - | |
| 169 | + | |
| 170 | + | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
| |||
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
223 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
224 | 233 | | |
225 | 234 | | |
226 | 235 | | |
| |||
1299 | 1308 | | |
1300 | 1309 | | |
1301 | 1310 | | |
1302 | | - | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
1303 | 1314 | | |
1304 | 1315 | | |
1305 | 1316 | | |
| |||
1314 | 1325 | | |
1315 | 1326 | | |
1316 | 1327 | | |
1317 | | - | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
1318 | 1331 | | |
1319 | 1332 | | |
1320 | 1333 | | |
| |||
1350 | 1363 | | |
1351 | 1364 | | |
1352 | 1365 | | |
1353 | | - | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1354 | 1369 | | |
1355 | 1370 | | |
1356 | 1371 | | |
| |||
1404 | 1419 | | |
1405 | 1420 | | |
1406 | 1421 | | |
1407 | | - | |
| 1422 | + | |
1408 | 1423 | | |
1409 | 1424 | | |
1410 | 1425 | | |
| |||
0 commit comments