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


Python Content.owner方法代码示例

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


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

示例1: update_file_data

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def update_file_data(self, item: Content, new_filename: str, new_mimetype: str, new_file_content) -> Content:
     item.owner = self._user
     item.file_name = new_filename
     item.file_mimetype = new_mimetype
     item.file_content = new_file_content
     item.revision_type = ActionDescription.REVISION
     return item
开发者ID:buxx,项目名称:tracim,代码行数:9,代码来源:content.py

示例2: create

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
    def create(self, content_type: str, workspace: Workspace, parent: Content=None, label:str ='', do_save=False, is_temporary: bool=False) -> Content:
        assert content_type in ContentType.allowed_types()

        if content_type == ContentType.Folder and not label:
            label = self.generate_folder_label(workspace, parent)

        content = Content()
        content.owner = self._user
        content.parent = parent
        content.workspace = workspace
        content.type = content_type
        content.label = label
        content.is_temporary = is_temporary
        content.revision_type = ActionDescription.CREATION

        if content.type in (
                ContentType.Page,
                ContentType.Thread,
        ):
            content.file_extension = '.html'

        if do_save:
            DBSession.add(content)
            self.save(content, ActionDescription.CREATION)
        return content
开发者ID:lebouquetin,项目名称:tracim,代码行数:27,代码来源:content.py

示例3: update_content

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def update_content(self, item: Content, new_label: str, new_content: str=None) -> Content:
     if item.label==new_label and item.description==new_content:
         raise SameValueError(_('The content did not changed'))
     item.owner = self._user
     item.label = new_label
     item.description = new_content if new_content else item.description # TODO: convert urls into links
     item.revision_type = ActionDescription.EDITION
     return item
开发者ID:buxx,项目名称:tracim,代码行数:10,代码来源:content.py

示例4: update_file_data

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def update_file_data(self, item: Content, new_filename: str, new_mimetype: str, new_content: bytes) -> Content:
     item.owner = self._user
     item.file_name = new_filename
     item.file_mimetype = new_mimetype
     item.depot_file = FileIntent(
         new_content,
         new_filename,
         new_mimetype,
     )
     item.revision_type = ActionDescription.REVISION
     return item
开发者ID:lebouquetin,项目名称:tracim,代码行数:13,代码来源:content.py

示例5: create_comment

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
    def create_comment(self, workspace: Workspace=None, parent: Content=None, content:str ='', do_save=False) -> Content:
        assert parent  and parent.type!=ContentType.Folder
        item = Content()
        item.owner = self._user
        item.parent = parent
        item.workspace = workspace
        item.type = ContentType.Comment
        item.description = content
        item.label = ''
        item.revision_type = ActionDescription.COMMENT

        if do_save:
            self.save(item, ActionDescription.COMMENT)
        return item
开发者ID:buxx,项目名称:tracim,代码行数:16,代码来源:content.py

示例6: create

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
    def create(self, content_type: str, workspace: Workspace, parent: Content=None, label:str ='', do_save=False) -> Content:
        assert content_type in ContentType.allowed_types()
        content = Content()
        content.owner = self._user
        content.parent = parent
        content.workspace = workspace
        content.type = content_type
        content.label = label
        content.revision_type = ActionDescription.CREATION

        if do_save:
            DBSession.add(content)
            self.save(content, ActionDescription.CREATION)
        return content
开发者ID:DarkDare,项目名称:tracim,代码行数:16,代码来源:content.py

示例7: undelete

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def undelete(self, content: Content):
     content.owner = self._user
     content.is_deleted = False
     content.revision_type = ActionDescription.UNDELETION
开发者ID:buxx,项目名称:tracim,代码行数:6,代码来源:content.py

示例8: delete

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def delete(self, content: Content):
     content.owner = self._user
     content.is_deleted = True
     content.revision_type = ActionDescription.DELETION
开发者ID:buxx,项目名称:tracim,代码行数:6,代码来源:content.py

示例9: unarchive

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def unarchive(self, content: Content):
     content.owner = self._user
     content.is_archived = False
     content.revision_type = ActionDescription.UNARCHIVING
开发者ID:buxx,项目名称:tracim,代码行数:6,代码来源:content.py

示例10: archive

# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import owner [as 别名]
 def archive(self, content: Content):
     content.owner = self._user
     content.is_archived = True
     content.revision_type = ActionDescription.ARCHIVING
开发者ID:buxx,项目名称:tracim,代码行数:6,代码来源:content.py


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