File: 03-avoid-unicoditis.patch

package info (click to toggle)
python-dsv 1.4.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 424 kB
  • sloc: python: 582; makefile: 7
file content (31 lines) | stat: -rw-r--r-- 1,137 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 744cbe48d6379316137b5fb32264289d7886b17a Mon Sep 17 00:00:00 2001
From: SVN-Git Migration <python-modules-team@lists.alioth.debian.org>
Date: Thu, 8 Oct 2015 11:58:09 -0700
Subject: 03-avoid-unicoditis

Patch-Name: 03-avoid-unicoditis.patch
---
 DSV/DSV.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/DSV/DSV.py b/DSV/DSV.py
index b17a91b..a925dd7 100644
--- a/DSV/DSV.py
+++ b/DSV/DSV.py
@@ -486,8 +486,14 @@ def importDSV(input, delimiter = ',', textQualifier = '"', columns = 0,
       list of lists of data
     """
     if type(input) != type([]):
-        raise InvalidData, "expected list of lists of strings"  
-    if type(delimiter) != type('') or not delimiter:
+        raise InvalidData, "expected list of lists of strings"
+    # Try to convert Unicode delimiters back to ASCII (wxPython can be
+    # overenthusiastic), but ultimately support either.
+    try:
+        delimiter = delimiter.encode()
+    except:
+        pass
+    if (type(delimiter) != str and type(delimiter) != unicode) or not delimiter:
         raise InvalidDelimiter, `delimiter`
 
 ##    if textQualifier: