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


Python ContentApi.archive方法代码示例

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


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

示例1: archive_content

# 需要导入模块: from tracim_backend.lib.core.content import ContentApi [as 别名]
# 或者: from tracim_backend.lib.core.content.ContentApi import archive [as 别名]
 def archive_content(
         self,
         context,
         request: TracimRequest,
         hapic_data=None,
 ) -> None:
     """
     Archives a content. The content will be invisible but still available.
     Difference with delete is that optimizing workspace will not delete archived contents
     This action requires the user to be a content manager.
     Note: the content is still accessible but becomes read-only.
     the difference with delete is that optimizing workspace will not delete archived contents
     """
     app_config = request.registry.settings['CFG']
     path_data = hapic_data.path
     api = ContentApi(
         show_archived=True,
         show_deleted=True,
         current_user=request.current_user,
         session=request.dbsession,
         config=app_config,
     )
     content = api.get_one(path_data.content_id, content_type=content_type_list.Any_SLUG)  # nopep8
     with new_revision(
             session=request.dbsession,
             tm=transaction.manager,
             content=content
     ):
         api.archive(content)
     return
开发者ID:tracim,项目名称:tracim,代码行数:32,代码来源:workspace_controller.py

示例2: insert

# 需要导入模块: from tracim_backend.lib.core.content import ContentApi [as 别名]
# 或者: from tracim_backend.lib.core.content.ContentApi import archive [as 别名]

#.........这里部分代码省略.........
            label='Fruits Desserts',
            parent=dessert_folder,
            do_save=True,
        )

        menu_page = content_api.create(
            content_type_slug=content_type_list.Page.slug,
            workspace=business_workspace,
            parent=menu_workspace,
            label='Current Menu',
            do_save=True,
        )

        new_fruit_salad = content_api.create(
            content_type_slug=content_type_list.Page.slug,
            workspace=recipe_workspace,
            parent=fruits_desserts_folder,
            label='New Fruit Salad',
            do_save=True,
        )
        old_fruit_salad = content_api.create(
            content_type_slug=content_type_list.Page.slug,
            workspace=recipe_workspace,
            parent=fruits_desserts_folder,
            label='Fruit Salad',
            do_save=True,
            do_notify=False,
        )
        with new_revision(
                session=self._session,
                tm=transaction.manager,
                content=old_fruit_salad,
        ):
            content_api.archive(old_fruit_salad)
        content_api.save(old_fruit_salad)

        bad_fruit_salad = content_api.create(
            content_type_slug=content_type_list.Page.slug,
            workspace=recipe_workspace,
            parent=fruits_desserts_folder,
            label='Bad Fruit Salad',
            do_save=True,
            do_notify=False,
        )
        with new_revision(
                session=self._session,
                tm=transaction.manager,
                content=bad_fruit_salad,
        ):
            content_api.delete(bad_fruit_salad)
        content_api.save(bad_fruit_salad)

        # File at the root for test
        new_fruit_salad = content_api.create(
            content_type_slug=content_type_list.Page.slug,
            workspace=other_workspace,
            label='New Fruit Salad',
            do_save=True,
        )
        old_fruit_salad = content_api.create(
            content_type_slug=content_type_list.Page.slug,
            workspace=other_workspace,
            label='Fruit Salad',
            do_save=True,
        )
        with new_revision(
开发者ID:tracim,项目名称:tracim,代码行数:70,代码来源:content.py


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