Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Warnings when serializing pymodm.MongoModel #998
Hey! I noticed that marshmallow produces the following warning when serializing a pymodm.MongoModel object
/.../python3.6/site-packages/marshmallow/schema.py:474: DeprecationWarning: Implicit collection handling is deprecated. Set many=True to serialize a collection. category=DeprecationWarning)
pymodm.MongoModel objects are not really meant to be collections in the sense of Tuples and Lists, but for some reason they're iterables.
I understand this is not precisely on your turf, so I've posted it on pymodm's channels, and I can provide a link to that discussion once that's approved (such bs...). But I was wondering if this issue might cause problems in the future, when providing the many=True flag becomes mandatory and pymodm.MongoModel objects are treated as collections.
This is a minimal example that reproduces the issue with marshmallow==2.16.0 and pymodm==0.4.1:
import warnings from pymodm import MongoModel, fields as mongofields from marshmallow import Schema, fields class A(MongoModel): name = mongofields.CharField() class ASchema(Schema): name = fields.Str() if __name__ == "__main__": warnings.simplefilter("always") a = A(name="asd") print(ASchema().dumps(a))