本文整理汇总了Python中invenio_records.Record.get_records方法的典型用法代码示例。如果您正苦于以下问题:Python Record.get_records方法的具体用法?Python Record.get_records怎么用?Python Record.get_records使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio_records.Record
的用法示例。
在下文中一共展示了Record.get_records方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_expired_embargos
# 需要导入模块: from invenio_records import Record [as 别名]
# 或者: from invenio_records.Record import get_records [as 别名]
def update_expired_embargos():
"""Release expired embargoes every midnight."""
record_ids = AccessRight.get_expired_embargos()
for record in Record.get_records(record_ids):
record['access_right'] = AccessRight.OPEN
record.commit()
db.session.commit()
indexer = RecordIndexer()
indexer.bulk_index(record_ids)
indexer.process_bulk_queue()
示例2: test_get_records
# 需要导入模块: from invenio_records import Record [as 别名]
# 或者: from invenio_records.Record import get_records [as 别名]
def test_get_records(app, db):
"""Test bulk record fetching."""
# Create test records
test_records = [
Record.create({"title": "test1"}),
Record.create({"title": "to_be_deleted"}),
Record.create({"title": "test3"}),
]
db.session.commit()
test_ids = [record.id for record in test_records]
# Fetch test records
assert len(Record.get_records(test_ids)) == 3
test_records[1].delete()
# should not show deleted
db.session.commit()
assert len(Record.get_records(test_ids)) == 2
# should show deleted
assert len(Record.get_records(test_ids, with_deleted=True)) == 3