Skip to content

New JSONProvider use of super() not quite right #512

Open
@jwag956

Description

@jwag956

I am implementing similar logic in Flask-Security - so stole some code :-)

The code:

class MongoEngineJSONProvider(superclass):
        """A JSON Provider update for Flask 2.2.0+"""

        @staticmethod
        def default(obj):
            """Extend JSONProvider default static method, with Mongo objects."""
            if isinstance(
                obj,
                (BaseDocument, QuerySet, CommandCursor, DBRef, ObjectId),
            ):
                return _convert_mongo_objects(obj)
            return super().default(obj)

I don't think is quite right - using super() for static methods doesn't work - you need to do something like:
return super(MongoEngineJSONProvider, MongoEngineJSONProvider).default(obj)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions