当前位置: 首页>>代码示例>>Python>>正文


Python Comment.update方法代码示例

本文整理汇总了Python中website.models.Comment.update方法的典型用法代码示例。如果您正苦于以下问题:Python Comment.update方法的具体用法?Python Comment.update怎么用?Python Comment.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在website.models.Comment的用法示例。


在下文中一共展示了Comment.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_folder_contents

# 需要导入模块: from website.models import Comment [as 别名]
# 或者: from website.models.Comment import update [as 别名]
def update_folder_contents(children, source_node, destination_node):
    for item in children:
        if not item.is_file:
            update_folder_contents(item.children, source_node, destination_node)
        else:
            Comment.update(Q('root_target', 'eq', item._id), data={'node': destination_node})
            # update node record of commented files
            if item._id in source_node.commented_files:
                destination_node.commented_files[item._id] = source_node.commented_files[item._id]
                del source_node.commented_files[item._id]
                source_node.save()
                destination_node.save()
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:14,代码来源:comment.py

示例2: update_comment_root_target_file

# 需要导入模块: from website.models import Comment [as 别名]
# 或者: from website.models.Comment import update [as 别名]
def update_comment_root_target_file(self, node, event_type, payload, user=None):
    if event_type == 'addon_file_moved':
        source = payload['source']
        destination = payload['destination']
        source_node = Node.load(source['node']['_id'])
        destination_node = node

        if (source.get('provider') == destination.get('provider') == 'osfstorage') and source_node._id != destination_node._id:
            old_file = FileNode.load(source.get('path').strip('/'))
            new_file = FileNode.resolve_class(destination.get('provider'), FileNode.FILE).get_or_create(destination_node, destination.get('path'))

            Comment.update(Q('root_target', 'eq', old_file._id), data={'node': destination_node})

            # update node record of commented files
            if old_file._id in source_node.commented_files:
                destination_node.commented_files[new_file._id] = source_node.commented_files[old_file._id]
                del source_node.commented_files[old_file._id]
                source_node.save()
                destination_node.save()
开发者ID:mchelen,项目名称:osf.io,代码行数:21,代码来源:comment.py

示例3: update_comment_node

# 需要导入模块: from website.models import Comment [as 别名]
# 或者: from website.models.Comment import update [as 别名]
def update_comment_node(root_target_id, source_node, destination_node):
    Comment.update(Q('root_target', 'eq', root_target_id), data={'node': destination_node})
    source_node.save()
    destination_node.save()
开发者ID:caspinelli,项目名称:osf.io,代码行数:6,代码来源:comment.py


注:本文中的website.models.Comment.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。