For example, this instance would previously get saved:
class Person(models.Model):
age = models.IntegerField()
>>> p = Person(age=[])
>>> p.save()
True
…and fail with a value error when loaded:
>>> Person.objects.get_by_id(p.id)
Traceback (most recent call last):
File "<ipython-input-5-623349df4911>", line 1, in <module>
Person.objects.get_by_id(p.id)
File "redisco/models/managers.py", line 40, in get_by_id
return self.get_model_set().get_by_id(id)
File "redisco/models/modelset.py", line 63, in get_by_id
return self._get_item_with_id(id)
File "redisco/models/modelset.py", line 276, in _get_item_with_id
instance.id = str(id)
File "redisco/models/base.py", line 328, in id
att.__set__(self, att.typecast_for_read(stored_attrs[att.name]))
File "redisco/models/attributes.py", line 153, in typecast_for_read
return int(value)
ValueError: invalid literal for int() with base 10: '[]'
With this patch:
>>> p = Person(age=[])
>>> p.save()
[('age', 'bad type')]
For example, this instance would previously get saved:
…and fail with a value error when loaded:
With this patch: