publishing.py 文件源码

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

项目:MongoFrames 作者: GetmeUK 项目源码 文件源码
def new_revision(self, *fields):
        """Save a new revision of the document"""

        # Ensure this document is a draft
        if not self._id:
            assert g.get('draft'), \
                    'Only draft documents can be assigned new revisions'
        else:
            with self.draft_context():
                assert self.count(Q._id == self._id) == 1, \
                        'Only draft documents can be assigned new revisions'

        # Set the revision
        if len(fields) > 0:
           fields.append('revision')

        self.revision = datetime.now()

        # Update the document
        self.upsert(*fields)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号