本文整理汇总了Python中indico.modules.attachments.models.attachments.Attachment.find方法的典型用法代码示例。如果您正苦于以下问题:Python Attachment.find方法的具体用法?Python Attachment.find怎么用?Python Attachment.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.attachments.models.attachments.Attachment
的用法示例。
在下文中一共展示了Attachment.find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _merge_users
# 需要导入模块: from indico.modules.attachments.models.attachments import Attachment [as 别名]
# 或者: from indico.modules.attachments.models.attachments.Attachment import find [as 别名]
def _merge_users(target, source, **kwargs):
from indico.modules.attachments.models.attachments import Attachment, AttachmentFile
from indico.modules.attachments.models.principals import AttachmentPrincipal, AttachmentFolderPrincipal
Attachment.find(user_id=source.id).update({Attachment.user_id: target.id})
AttachmentFile.find(user_id=source.id).update({AttachmentFile.user_id: target.id})
AttachmentPrincipal.merge_users(target, source, 'attachment')
AttachmentFolderPrincipal.merge_users(target, source, 'folder')
示例2: _build_base_query
# 需要导入模块: from indico.modules.attachments.models.attachments import Attachment [as 别名]
# 或者: from indico.modules.attachments.models.attachments.Attachment import find [as 别名]
def _build_base_query(self, added_since=None):
query = Attachment.find(Attachment.type == AttachmentType.file, ~AttachmentFolder.is_deleted,
~Attachment.is_deleted, AttachmentFolder.event_new == self.event_new,
_join=AttachmentFolder)
if added_since is not None:
query = query.join(Attachment.file).filter(cast(AttachmentFile.created_dt, Date) >= added_since)
return query
示例3: materialToXMLMarc21
# 需要导入模块: from indico.modules.attachments.models.attachments import Attachment [as 别名]
# 或者: from indico.modules.attachments.models.attachments.Attachment import find [as 别名]
def materialToXMLMarc21(self, obj, out=None):
if not out:
out = self._XMLGen
for attachment in (Attachment.find(~AttachmentFolder.is_deleted, AttachmentFolder.object == obj,
is_deleted=False, _join=AttachmentFolder)
.options(joinedload(Attachment.legacy_mapping))):
if attachment.can_access(self.__aw.getUser().user):
self.resourceToXMLMarc21(attachment, out)
self._generateAccessList(acl=self._attachment_access_list(attachment), out=out,
objId=self._attachment_unique_id(attachment, add_prefix=False))
示例4: find_attachments
# 需要导入模块: from indico.modules.attachments.models.attachments import Attachment [as 别名]
# 或者: from indico.modules.attachments.models.attachments.Attachment import find [as 别名]
def find_attachments(self):
return Attachment.find(~AttachmentFolder.is_deleted, ~Attachment.is_deleted,
AttachmentFolder.event_id == int(self.event.id), _join=AttachmentFolder)
示例5: _count_attachments
# 需要导入模块: from indico.modules.attachments.models.attachments import Attachment [as 别名]
# 或者: from indico.modules.attachments.models.attachments.Attachment import find [as 别名]
def _count_attachments(cls, obj):
return Attachment.find(~AttachmentFolder.is_deleted, AttachmentFolder.linked_object == obj,
is_deleted=False, _join=AttachmentFolder).count()