(self, op, value)
| 948 | super().validate(value) |
| 949 | |
| 950 | def prepare_query_value(self, op, value): |
| 951 | # Validate that the `set` operator doesn't contain more items than `max_length`. |
| 952 | if op == "set" and self.max_length is not None and len(value) > self.max_length: |
| 953 | self.error("List is too long") |
| 954 | |
| 955 | if self.field: |
| 956 | # If the value is iterable and it's not a string nor a |
| 957 | # BaseDocument, call prepare_query_value for each of its items. |
| 958 | is_iter = hasattr(value, "__iter__") |
| 959 | eligible_iter = is_iter and not isinstance(value, (str, BaseDocument)) |
| 960 | if ( |
| 961 | op in ("set", "unset", "gt", "gte", "lt", "lte", "ne", None) |
| 962 | and eligible_iter |
| 963 | ): |
| 964 | return [self.field.prepare_query_value(op, v) for v in value] |
| 965 | |
| 966 | return self.field.prepare_query_value(op, value) |
| 967 | |
| 968 | return super().prepare_query_value(op, value) |
| 969 | |
| 970 | |
| 971 | class EmbeddedDocumentListField(ListField): |
nothing calls this directly
no test coverage detected