def register_model(self, model_cls):
        """Decorator for registering model."""
        if not getattr(model_cls, '_database_'):
            raise ModelAttributeError('_database_ missing '
                                      'on %s!' % model_cls.__name__)
        if not getattr(model_cls, '_collection_'):
            raise ModelAttributeError('_collection_ missing '
                                      'on %s!' % model_cls.__name__)

        model_cls._mongo_client_ = self.client

        logging.info('Registering Model ' + model_cls.__name__)
        return model_cls
def register_model ( self , model_cls ) : if not getattr ( model_cls , '_database_' ) : raise ModelAttributeError ( '_database_ missing ' 'on %s!' % model_cls . __name__ ) if not getattr ( model_cls , '_collection_' ) : raise ModelAttributeError ( '_collection_ missing ' 'on %s!' % model_cls . __name__ ) model_cls . _mongo_client_ = self . client logging . info ( 'Registering Model ' + model_cls . __name__ ) return model_cls
Decorator for registering model.