Skip to content

Commit ad046a1

Browse files
authored
Update mongo_utils.py
1 parent 31bbcfb commit ad046a1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

aiohttp_admin/backends/mongo_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ def apply_trafaret(trafaret, value):
5858
if isinstance(trafaret, MongoId):
5959
validate = trafaret.converter
6060

61-
if isinstance(value, list) and not isinstance(trafaret, t.List):
62-
value = [validate(v) for v in value]
61+
if isinstance(value, list):
62+
try:
63+
value = validate(value)
64+
except t.DataError:
65+
value = [validate(v) for v in value]
6366
else:
6467
value = validate(value)
6568
return value

0 commit comments

Comments
 (0)