當前位置: 首頁>>代碼示例>>Python>>正文


Python WorkspaceApi.ensure_calendar_exist方法代碼示例

本文整理匯總了Python中tracim.lib.workspace.WorkspaceApi.ensure_calendar_exist方法的典型用法代碼示例。如果您正苦於以下問題:Python WorkspaceApi.ensure_calendar_exist方法的具體用法?Python WorkspaceApi.ensure_calendar_exist怎麽用?Python WorkspaceApi.ensure_calendar_exist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tracim.lib.workspace.WorkspaceApi的用法示例。


在下文中一共展示了WorkspaceApi.ensure_calendar_exist方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: put

# 需要導入模塊: from tracim.lib.workspace import WorkspaceApi [as 別名]
# 或者: from tracim.lib.workspace.WorkspaceApi import ensure_calendar_exist [as 別名]
    def put(self, id, name, description, calendar_enabled: str='off'):
        user = tmpl_context.current_user
        workspace_api_controller = WorkspaceApi(user)
        calendar_enabled = on_off_to_boolean(calendar_enabled)
        workspace = workspace_api_controller.get_one(id)

        # Display error page to user if chosen label is in conflict
        if name != workspace.label and \
                not self._path_validation.workspace_label_is_free(name):
            return render_invalid_integrity_chosen_path(name)

        workspace.label = name
        workspace.description = description
        workspace.calendar_enabled = calendar_enabled
        workspace_api_controller.save(workspace)

        if calendar_enabled:
            workspace_api_controller.ensure_calendar_exist(workspace)

        tg.flash(_('{} workspace updated.').format(workspace.label), CST.STATUS_OK)
        tg.redirect(self.url(workspace.workspace_id))
        return
開發者ID:buxx,項目名稱:tracim,代碼行數:24,代碼來源:workspace.py


注:本文中的tracim.lib.workspace.WorkspaceApi.ensure_calendar_exist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。