本文整理汇总了Python中tracim.lib.content.ContentApi.revision_type方法的典型用法代码示例。如果您正苦于以下问题:Python ContentApi.revision_type方法的具体用法?Python ContentApi.revision_type怎么用?Python ContentApi.revision_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim.lib.content.ContentApi
的用法示例。
在下文中一共展示了ContentApi.revision_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_event
# 需要导入模块: from tracim.lib.content import ContentApi [as 别名]
# 或者: from tracim.lib.content.ContentApi import revision_type [as 别名]
def add_event(
self,
calendar: Calendar,
event: iCalendarEvent,
event_name: str,
owner: User,
) -> Content:
"""
Create Content event type.
:param calendar: Event calendar owner
:param event: ICS event
:param event_name: Event name (ID) like
20160602T083511Z-18100-1001-1-71_Bastien-20160602T083516Z.ics
:param owner: Event Owner
:return: Created Content
"""
workspace = None
if isinstance(calendar, WorkspaceCalendar):
workspace = calendar.related_object
elif isinstance(calendar, UserCalendar):
pass
else:
raise UnknownCalendarType('Type "{0}" is not implemented'
.format(type(calendar)))
content = ContentApi(owner).create(
content_type=ContentType.Event,
workspace=workspace,
do_save=False
)
self.populate_content_with_event(
content,
event,
event_name
)
content.revision_type = ActionDescription.CREATION
DBSession.add(content)
DBSession.flush()
transaction.commit()
return content