本文整理匯總了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