kuasha/cosmos

View on GitHub
cosmos/service/utils.py

Summary

Maintainability
A
0 mins
Test Coverage
"""
 Copyright (C) 2014 Maruf Maniruzzaman
 Website: http://cosmosframework.com
 Author: Maruf Maniruzzaman
 License :: OSI Approved :: MIT License
"""

import json
from bson import ObjectId

class MongoObjectJSONEncoder(json.JSONEncoder):
    def default(self, o):
        if isinstance(o, ObjectId):
            return str(o)
        return json.JSONEncoder.default(self, o)


class Options:
    def __init__(self, **entries):
        self.__dict__.update(entries)