New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings when serializing pymodm.MongoModel #998

Closed
lalvarezguillen opened this Issue Oct 14, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@lalvarezguillen

lalvarezguillen commented Oct 14, 2018

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))

Thanks!

@sloria

This comment has been minimized.

Member

sloria commented Oct 18, 2018

Hm, implicit collection handling was removed in version 0.5.0, so that warning is old and misleading.

I've removed it in #1010.

Thanks for reporting @lalvarezguillen .

@sloria sloria closed this in 1608c96 Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment