本文整理汇总了Python中tracim.model.data.Content.description方法的典型用法代码示例。如果您正苦于以下问题:Python Content.description方法的具体用法?Python Content.description怎么用?Python Content.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim.model.data.Content
的用法示例。
在下文中一共展示了Content.description方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_content
# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import description [as 别名]
def update_content(self, item: Content, new_label: str, new_content: str=None) -> Content:
if item.label==new_label and item.description==new_content:
raise SameValueError(_('The content did not changed'))
item.owner = self._user
item.label = new_label
item.description = new_content if new_content else item.description # TODO: convert urls into links
item.revision_type = ActionDescription.EDITION
return item
示例2: create_comment
# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import description [as 别名]
def create_comment(self, workspace: Workspace=None, parent: Content=None, content:str ='', do_save=False) -> Content:
assert parent and parent.type!=ContentType.Folder
item = Content()
item.owner = self._user
item.parent = parent
item.workspace = workspace
item.type = ContentType.Comment
item.description = content
item.label = ''
item.revision_type = ActionDescription.COMMENT
if do_save:
self.save(item, ActionDescription.COMMENT)
return item
示例3: test_serialize_Content_comment_THREAD
# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import description [as 别名]
def test_serialize_Content_comment_THREAD(self):
wor = Workspace()
wor.workspace_id = 4
fol = Content()
fol.type = ContentType.Folder
fol.content_id = 72
fol.workspace = wor
par = Content()
par.type = ContentType.Thread
par.content_id = 37
par.parent = fol
par.workspace = wor
par.created = datetime.now()
obj = Content()
obj.type = ContentType.Comment
obj.content_id = 132
obj.label = 'some label'
obj.description = 'Some Description'
obj.parent = par
obj.created = datetime.now()
print('LANGUAGES #2 ARE', tg.i18n.get_lang())
res = Context(CTX.THREAD).toDict(obj)
eq_(res.__class__, DictLikeClass, res)
ok_('label' in res.keys())
eq_(obj.label, res.label, res)
ok_('content' in res.keys())
eq_(obj.description, res.content, res)
ok_('created' in res.keys())
ok_('icon' in res.keys())
eq_(ContentType.get_icon(obj.type), res.icon, res)
ok_('delete' in res.urls.keys())
eq_(10, len(res.keys()), len(res.keys()))
示例4: test_serialize_Content_DEFAULT
# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import description [as 别名]
def test_serialize_Content_DEFAULT(self):
self.app.get('/_test_vars') # Allow to create fake context
obj = Content()
obj.content_id = 132
obj.label = 'Some label'
obj.description = 'Some Description'
res = Context(CTX.DEFAULT).toDict(obj)
eq_(res.__class__, DictLikeClass, res)
eq_(obj.content_id, res.id, res)
eq_(obj.label, res.label, res)
ok_('folder' in res.keys())
ok_('id' in res.folder.keys())
eq_(None, res.folder.id)
eq_(1, len(res.folder.keys()))
ok_('workspace' in res.keys())
eq_(None, res.workspace, res)
eq_(4, len(res.keys()), res)
示例5: populate_content_with_event
# 需要导入模块: from tracim.model.data import Content [as 别名]
# 或者: from tracim.model.data.Content import description [as 别名]
def populate_content_with_event(
self,
content: Content,
event: iCalendarEvent,
event_name: str,
) -> None:
"""
Populate Content content instance from iCalendarEvent event attributes.
:param content: content to populate
:param event: event with data to insert in content
:param event_name: Event name (ID) like
20160602T083511Z-18100-1001-1-71_Bastien-20160602T083516Z.ics
:return: given content
"""
content.label = event.get('summary')
content.description = event.get('description')
content.properties = {
'name': event_name,
'location': event.get('location'),
'raw': event.to_ical().decode("utf-8"),
'start': event.get('dtend').dt.strftime('%Y-%m-%d %H:%M:%S%z'),
'end': event.get('dtstart').dt.strftime('%Y-%m-%d %H:%M:%S%z'),
}