# Path: apis/settings.py
# class Config(LConfig):
#     pass


import copy
from six import with_metaclass
from bson.objectid import ObjectId
from pymongo import MongoClient
from pymongo import ReturnDocument
from apis.settings import Config

class ObjectModel(object):

    def __init__(self, *args, **kwargs):
        for k, v in kwargs.items():
            setattr(self, k, v)

    @classmethod
    def object_from_dictionary(cls, entry):
        # make dict keys all strings
        if entry is None:
            return ""
        entry_str_dict = dict([(str(key), value) for key, value in entry.items()])
        return cls(**entry_str_dict)

    def __repr__(self):
        return str(self)

    def __str__(self):
        return self.__unicode__()


class ModelMetaclass(type):
    """
    Metaclass of the Model.
    """
    __collection__ = None

    def __init__(cls, name, bases, attrs):
        super(ModelMetaclass, cls).__init__(name, bases, attrs)

# Path: apis/settings.py
# class Config(LConfig):
#     pass


# Path: apis/models/model.py
import copy
from six import with_metaclass
from bson.objectid import ObjectId
from pymongo import MongoClient
from pymongo import ReturnDocument
from apis.settings import Config


class ObjectModel(object):

    def __init__(self, *args, **kwargs):
        for k, v in kwargs.items():
            setattr(self, k, v)

    @classmethod
    def object_from_dictionary(cls, entry):
        # make dict keys all strings
        if entry is None:
            return ""
        entry_str_dict = dict([(str(key), value) for key, value in entry.items()])
        return cls(**entry_str_dict)

    def __repr__(self):
        return str(self)

    def __str__(self):
        return self.__unicode__()


class ModelMetaclass(type):
    """
    Metaclass of the Model.
    """
    __collection__ = None

    def __init__(cls, name, bases, attrs):
        super(ModelMetaclass, cls).__init__(name, bases, attrs)

        cls.db = pyclient[Config.MONGO_DATABASE]