mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix: optional list field serialize-deserialize (#622)
This commit is contained in:
parent
a26c6428a3
commit
2b4e3ad5c6
1 changed files with 6 additions and 0 deletions
|
|
@ -129,6 +129,9 @@ class ListField(Field):
|
|||
super(ListField, self).__init__(*args, default=default, **kwargs)
|
||||
|
||||
def serialize(self, value):
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
result = []
|
||||
serialize = super(ListField, self).serialize
|
||||
for item in value:
|
||||
|
|
@ -136,6 +139,9 @@ class ListField(Field):
|
|||
return result
|
||||
|
||||
def deserialize(self, value, parent=None):
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
result = []
|
||||
deserialize = super(ListField, self).deserialize
|
||||
for item in value:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue