File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -520,6 +520,8 @@ def __del__(self):
520
520
class Resource (object ):
521
521
522
522
def __init__ (self , url , session , headers = None ):
523
+ if sys .version_info [0 ] == 2 and isinstance (url , util .utype ):
524
+ url = url .encode ('utf-8' ) # kind of an ugly hack for issue 235
523
525
self .url , self .credentials = extract_credentials (url )
524
526
if session is None :
525
527
session = Session ()
Original file line number Diff line number Diff line change 10
10
import os
11
11
import os .path
12
12
import shutil
13
+ import sys
13
14
import time
14
15
import tempfile
15
16
import threading
@@ -116,6 +117,20 @@ def test_uuids(self):
116
117
ls = self .server .uuids (count = 10 )
117
118
assert type (ls ) == list and len (ls ) == 10
118
119
120
+ def test_235_unicode_server (self ):
121
+
122
+ url = client .DEFAULT_BASE_URL
123
+ if not isinstance (url , util .utype ):
124
+ url = url .decode ('utf-8' )
125
+
126
+ server = client .Server (url )
127
+ dbname = 'couchdb-python/test-235-unicode-server'
128
+ db = server .create (dbname )
129
+ try :
130
+ db .update ([{'foo' : u'\ua000 ' }])
131
+ finally :
132
+ server .delete (dbname )
133
+
119
134
120
135
class DatabaseTestCase (testutil .TempDatabaseMixin , unittest .TestCase ):
121
136
You can’t perform that action at this time.
0 commit comments