publishing.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:MongoFrames 作者: GetmeUK 项目源码 文件源码
def get_collection(cls):
        """Return a reference to the database collection for the class"""

        # By default the collection returned will be the published collection,
        # however if the `draft` flag has been set against the global context
        # (e.g `g`) then the collection returned will contain draft documents.

        if g.get('draft'):
            return getattr(
                cls.get_db(),
                '{collection}_draft'.format(collection=cls._collection)
                )

        return getattr(cls.get_db(), cls._collection)

    # Contexts
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号