You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
I am implementing similar logic in Flask-Security - so stole some code :-)
The code:
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)
The text was updated successfully, but these errors were encountered: