Skip to content

Commit cc215a4

Browse files
committed
Make use_list param configurable
By default the `use_list` parameter tells msgpack to unpack array to Python's list which is not hashable and can not be used as a dict keys and sets elements. Django expects the response rows to be tuples because it will be used in python set() [1] Now the `use_list` parameter can be configured in the Connection init [1] https://github.com/django/django/blob/stable/3.0.x/django/contrib/auth/management/__init__.py#L72
1 parent 5f271bf commit cc215a4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tarantool/connection.py

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def __init__(self, host, port,
108108
connect_now=True,
109109
encoding=ENCODING_DEFAULT,
110110
call_16=False,
111+
use_list=True,
111112
connection_timeout=CONNECTION_TIMEOUT):
112113
'''
113114
Initialize a connection to the server.
@@ -142,6 +143,7 @@ def __init__(self, host, port,
142143
self.error = True
143144
self.encoding = encoding
144145
self.call_16 = call_16
146+
self.use_list = use_list
145147
self.connection_timeout = connection_timeout
146148
if connect_now:
147149
self.connect()

tarantool/response.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self, conn, response):
5353
# created in the __new__().
5454
# super(Response, self).__init__()
5555

56-
kwargs = dict(use_list=True)
56+
kwargs = dict(use_list=conn.use_list)
5757
if msgpack.version >= (1, 0, 0):
5858
# XXX: Explain why it is necessary.
5959
kwargs['strict_map_key'] = False

0 commit comments

Comments
 (0)