コード例 #1
0
ファイル: collection.py プロジェクト: wronglink/ognom
    def collection(self):
        if not self.collection_name:
            self.collection_name = '{}'.format(
                self.model_class.__name__.lower())

        if not self._collection:
            db = ConnectionManager.get_database(self.db_name)
            if not db:
                raise ConnectionFailure('No connection for {}'.format(
                    self.db_name))
            self._collection = getattr(db, self.collection_name)
        return self._collection
コード例 #2
0
ファイル: collection.py プロジェクト: gukoff/ognom
    def collection(self):
        if not self.collection_name:
            self.collection_name = '{}'.format(
                self.model_class.__name__.lower())

        if not self._collection:
            db = ConnectionManager.get_database(self.db_name)
            if not db:
                raise ConnectionFailure(
                    'No connection for {}'.format(self.db_name))
            self._collection = getattr(db, self.collection_name)
        return self._collection