changing list column behavior to load lists, not tuples, from the database
This commit is contained in:
@@ -433,6 +433,10 @@ class List(BaseContainerColumn):
|
|||||||
raise ValidationError('{} is not a list object'.format(val))
|
raise ValidationError('{} is not a list object'.format(val))
|
||||||
return [self.value_col.validate(v) for v in val]
|
return [self.value_col.validate(v) for v in val]
|
||||||
|
|
||||||
|
def to_python(self, value):
|
||||||
|
if value is None: return None
|
||||||
|
return list(value)
|
||||||
|
|
||||||
def to_database(self, value):
|
def to_database(self, value):
|
||||||
if value is None: return None
|
if value is None: return None
|
||||||
if isinstance(value, self.Quoter): return value
|
if isinstance(value, self.Quoter): return value
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ class TestListColumn(BaseCassEngTestCase):
|
|||||||
m1 = TestListModel.create(int_list=[1,2], text_list=['kai', 'andreas'])
|
m1 = TestListModel.create(int_list=[1,2], text_list=['kai', 'andreas'])
|
||||||
m2 = TestListModel.get(partition=m1.partition)
|
m2 = TestListModel.get(partition=m1.partition)
|
||||||
|
|
||||||
assert isinstance(m2.int_list, tuple)
|
assert isinstance(m2.int_list, list)
|
||||||
assert isinstance(m2.text_list, tuple)
|
assert isinstance(m2.text_list, list)
|
||||||
|
|
||||||
assert len(m2.int_list) == 2
|
assert len(m2.int_list) == 2
|
||||||
assert len(m2.text_list) == 2
|
assert len(m2.text_list) == 2
|
||||||
|
|||||||
Reference in New Issue
Block a user