Skip to content

Commit f03df36

Browse files
committed
Make use_list param configurable
It is set up to be converted to lists by default. Django expects row type to be tuple. Also tuples tend to perform better than lists and it is good if it can be configurable. Closes #166
1 parent 26063de commit f03df36

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: tarantool/connection.py

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def __init__(self, host, port,
9393
reconnect_delay=RECONNECT_DELAY,
9494
connect_now=True,
9595
encoding=ENCODING_DEFAULT,
96+
use_list=True,
9697
call_16=False,
9798
connection_timeout=CONNECTION_TIMEOUT):
9899
'''
@@ -132,6 +133,7 @@ def __init__(self, host, port,
132133
self.connected = False
133134
self.error = True
134135
self.encoding = encoding
136+
self.use_list = use_list
135137
self.call_16 = call_16
136138
self.connection_timeout = connection_timeout
137139
if connect_now:

Diff for: tarantool/response.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ def __init__(self, conn, response):
5555

5656
unpacker_kwargs = dict()
5757

58-
# Decode msgpack arrays into Python lists (not tuples).
59-
unpacker_kwargs['use_list'] = True
58+
# Decode msgpack arrays into Python lists by default (not tuples).
59+
# Can be configured in the Connection init
60+
unpacker_kwargs['use_list'] = conn.use_list
6061

6162
# Use raw=False instead of encoding='utf-8'.
6263
if msgpack.version >= (0, 5, 2) and conn.encoding == 'utf-8':

0 commit comments

Comments
 (0)