本文整理汇总了Python中indico.modules.attachments.models.attachments.Attachment.folder方法的典型用法代码示例。如果您正苦于以下问题:Python Attachment.folder方法的具体用法?Python Attachment.folder怎么用?Python Attachment.folder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.attachments.models.attachments.Attachment
的用法示例。
在下文中一共展示了Attachment.folder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _process
# 需要导入模块: from indico.modules.attachments.models.attachments import Attachment [as 别名]
# 或者: from indico.modules.attachments.models.attachments.Attachment import folder [as 别名]
def _process(self):
form = AddAttachmentLinkForm(linked_object=self.object)
if form.validate_on_submit():
folder = form.folder.data or AttachmentFolder.get_or_create_default(linked_object=self.object)
link = Attachment(user=session.user, type=AttachmentType.link)
form.populate_obj(link, skip={'acl'})
if link.is_protected:
link.acl = form.acl.data
link.folder = folder
db.session.flush()
logger.info('Attachment {} added by {}'.format(link, session.user))
signals.attachments.attachment_created.send(link, user=session.user)
flash(_("The link has been added"), 'success')
return jsonify_data(attachment_list=_render_attachment_list(self.object))
return jsonify_template('attachments/add_link.html', form=form,
protection_message=_render_protection_message(self.object),
folders_protection_info=_get_folders_protection_info(self.object))