本文整理汇总了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