本文整理汇总了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()
示例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()
示例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()