本文整理汇总了Python中invenio_deposit.models.Deposition.get方法的典型用法代码示例。如果您正苦于以下问题:Python Deposition.get方法的具体用法?Python Deposition.get怎么用?Python Deposition.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio_deposit.models.Deposition
的用法示例。
在下文中一共展示了Deposition.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import get [as 别名]
def test_create(self):
"""Test."""
from invenio.ext.login.legacy_user import UserInfo
from invenio_deposit.models import Deposition
user = UserInfo(uid=1)
d = Deposition.create(user)
assert d.type == self.DefaultType
assert Deposition.get(d.id).type == self.DefaultType
d2 = Deposition.create(user, type=self.AnotherType)
assert d2.type == self.AnotherType
assert Deposition.get(d2.id).type == self.AnotherType
# remove the records
Deposition.delete(d)
Deposition.delete(d2)
示例2: run_deposition_tasks
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import get [as 别名]
def run_deposition_tasks(self, deposition_id, with_webcoll=True):
"""
Run all task ids specified in the latest SIP and optionally run
webcoll.
"""
# Run submitted tasks
from invenio_deposit.models import Deposition
dep = Deposition.get(deposition_id)
sip = dep.get_latest_sip(sealed=True)
for task_id in sip.task_ids:
self.run_task_id(task_id)
if with_webcoll:
# Check if record is accessible
response = self.client.get(
url_for('record.metadata', recid=sip.metadata['recid']),
base_url=self.app.config['CFG_SITE_SECURE_URL'],
)
self.assertStatus(response, 200)